From 57b209aed99a4b2df165c31005a7cec03c7ed74e Mon Sep 17 00:00:00 2001 From: Camden Narzt Date: Sat, 2 Mar 2024 18:59:22 -0700 Subject: [PATCH] bump version and release on successful run --- .github/workflows/go.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d331e90..71a5816 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -13,6 +13,8 @@ jobs: build: runs-on: macos-latest + permissions: + contents: write strategy: matrix: go: @@ -32,6 +34,8 @@ jobs: - uses: actions/checkout@v4 with: path: getargv.go + fetch-tags: true + fetch-depth: 0 # until https://github.com/actions/checkout/issues/1471 fixed - name: Set up Go uses: actions/setup-go@v5 with: @@ -43,3 +47,18 @@ jobs: - name: Test run: go test -C getargv.go + + - name: Bump Version + id: bump_version + run: git tag | sort -V | tail -1 | awk -F. 'BEGIN { OFS = "." } {$NF+=1; print $0}' | xargs -I {} echo "new_version={}" >> $GITHUB_OUTPUT + working-directory: getargv-swift + - name: create && push tag + run: | + git tag '${{ steps.bump_version.outputs.new_version }}' + git push origin tag '${{ steps.bump_version.outputs.new_version }}' + git push origin HEAD:main + working-directory: getargv-swift + - uses: softprops/action-gh-release@v1 + with: + name: ${{ steps.bump_version.outputs.new_version }} + tag_name: ${{ steps.bump_version.outputs.new_version }}