Skip to content

Commit 57b209a

Browse files
committed
bump version and release on successful run
1 parent 056f65f commit 57b209a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

.github/workflows/go.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313

1414
build:
1515
runs-on: macos-latest
16+
permissions:
17+
contents: write
1618
strategy:
1719
matrix:
1820
go:
@@ -32,6 +34,8 @@ jobs:
3234
- uses: actions/checkout@v4
3335
with:
3436
path: getargv.go
37+
fetch-tags: true
38+
fetch-depth: 0 # until https://github.com/actions/checkout/issues/1471 fixed
3539
- name: Set up Go
3640
uses: actions/setup-go@v5
3741
with:
@@ -43,3 +47,18 @@ jobs:
4347

4448
- name: Test
4549
run: go test -C getargv.go
50+
51+
- name: Bump Version
52+
id: bump_version
53+
run: git tag | sort -V | tail -1 | awk -F. 'BEGIN { OFS = "." } {$NF+=1; print $0}' | xargs -I {} echo "new_version={}" >> $GITHUB_OUTPUT
54+
working-directory: getargv-swift
55+
- name: create && push tag
56+
run: |
57+
git tag '${{ steps.bump_version.outputs.new_version }}'
58+
git push origin tag '${{ steps.bump_version.outputs.new_version }}'
59+
git push origin HEAD:main
60+
working-directory: getargv-swift
61+
- uses: softprops/action-gh-release@v1
62+
with:
63+
name: ${{ steps.bump_version.outputs.new_version }}
64+
tag_name: ${{ steps.bump_version.outputs.new_version }}

0 commit comments

Comments
 (0)