@@ -2,6 +2,7 @@ name: Release
22
33on :
44 workflow_dispatch :
5+
56 push :
67 branches :
78 - main
@@ -16,40 +17,46 @@ jobs:
1617 runs-on : ubuntu-latest
1718
1819 steps :
19- - uses : actions/checkout@v4
20+ - name : Checkout
21+ uses : actions/checkout@v4
2022 with :
2123 fetch-depth : 0
2224
23- - uses : actions/setup-go@v5
25+ - name : Set up Go
26+ uses : actions/setup-go@v5
2427 with :
2528 go-version-file : go.mod
2629 cache : true
2730
2831 - name : Read version
2932 id : version
3033 run : |
31- VERSION=$(cat VERSION | tr -d '\r\n')
34+ VERSION=$(tr -d '\r\n' < VERSION )
3235 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
3336
34- - name : Create tag
37+ - name : Create and push tag
3538 run : |
3639 TAG="v${{ steps.version.outputs.version }}"
3740
3841 if git rev-parse "$TAG" >/dev/null 2>&1; then
39- echo "Tag already exists"
40- exit 0
41- fi
42+ echo "Tag $TAG already exists"
43+ else
44+ git config user.name "github-actions[bot]"
45+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
4246
43- git config user.name "github-actions[bot]"
44- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
47+ git tag -a "$TAG" -m "Release $TAG"
48+ git push origin "$TAG"
49+ fi
4550
46- git tag -a "$TAG" -m "Release $TAG"
47- git push origin "$TAG"
51+ - name : Fetch tags
52+ run : git fetch --force --tags
4853
4954 - name : Run GoReleaser
55+ uses : goreleaser/goreleaser-action@v6
5056 env :
5157 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
52- run : |
53- git fetch --tags
54- goreleaser release --clean
58+ with :
59+ distribution : goreleaser
60+ version : " ~> v2"
61+ args : release --clean
5562
0 commit comments