-
Notifications
You must be signed in to change notification settings - Fork 280
41 lines (41 loc) · 1.66 KB
/
build-and-draft-release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Build and Draft Release
on:
pull_request:
types: [closed]
workflow_dispatch:
inputs:
version:
type: string
description: The released version without 'v'. For example, 1.0.0.
jobs:
draft_release:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release')) }}
steps:
- name: Set VERSION variable
# The head ref looks like release/v1.0.0, and we need to trim the string up to the `/v`.
run: |
VERSION="${{ github.event.inputs.version || github.head_ref}}"
echo "VERSION=${VERSION##*/v}" >> $GITHUB_ENV
- name: Checkout repository code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21.x"
- name: Set up Git name and email
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Build assets and draft release
run: bash ./make/buf/scripts/draftrelease.bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WEBHOOK_URL: ${{ secrets.SLACK_RELEASE_NOTIFICATION_WEBHOOK }}
RELEASE_MINISIGN_PRIVATE_KEY: ${{secrets.RELEASE_MINISIGN_PRIVATE_KEY}}
RELEASE_MINISIGN_PRIVATE_KEY_PASSWORD: ${{secrets.RELEASE_MINISIGN_PRIVATE_KEY_PASSWORD}}
- name: Unset keys
if: ${{ always() }}
run: |
unset RELEASE_MINISIGN_PRIVATE_KEY
unset RELEASE_MINISIGN_PRIVATE_KEY_PASSWORD