-
Notifications
You must be signed in to change notification settings - Fork 17
67 lines (62 loc) · 1.8 KB
/
release.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
name: release
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
on:
# Run this workflow on the completion of the build-integration workflow
workflow_run:
workflows:
- build-integration
types:
- completed
branches:
- master
# required to upload artifacts to github releases
permissions:
contents: write
jobs:
requires-release:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
release: ${{ steps.version.outputs.release }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get Version
id: version
run: |
CURRENT_VERSION="v$(cat VERSION)"
if [[ $(git tag -l "${CURRENT_VERSION}") == "${CURRENT_VERSION}" ]]; then
echo "Version ${CURRENT_VERSION} is already released"
echo "release=false" >> "$GITHUB_OUTPUT"
else
echo "Version ${CURRENT_VERSION} can be release"
echo "release=true" >> "$GITHUB_OUTPUT"
fi
exit 0
release:
needs: requires-release
if: ${{ needs.requires-release.outputs.release == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version: 1.20.5
- name: Create tag for new version
run: |
CURRENT_VERSION="v$(cat VERSION)"
git tag $CURRENT_VERSION
git push origin $CURRENT_VERSION
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}