-
Notifications
You must be signed in to change notification settings - Fork 10
45 lines (43 loc) · 1.34 KB
/
release_workflow.yml
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
42
43
44
45
name: release_workflow
on:
pull_request:
types:
- closed
jobs:
release_workflow:
if: ${{ github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/') }}
environment: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: main
submodules: true
- uses: actions/setup-go@v3
with:
go-version: '1.18'
- run: make install_tools
- name: Extract version from branch name
id: version
run: |
BRANCH_NAME=${{ github.event.pull_request.head.ref }}
VERSION=v${BRANCH_NAME#release/}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Ensure changelog exists
run: ls changes/${{ steps.version.outputs.VERSION }}.md
- name: Generate extra files
run: make release_extra_files
- name: Tag version
run: |
VERSION=${{ steps.version.outputs.VERSION }}
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git tag -a -F changes/$VERSION.md $VERSION
git push origin $VERSION
- name: Run goreleaser
run: |
goreleaser release \
--release-notes=changes/${{ steps.version.outputs.VERSION }}.md \
--skip-validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}