Skip to content

bump version and release on successful run #4

bump version and release on successful run

bump version and release on successful run #4

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: macos-latest
permissions:
contents: write
strategy:
matrix:
go:
- '1.22'
- '1.21'
# https://go.dev/doc/devel/release
name: Go ${{ matrix.go }}
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make install_dylib
working-directory: getargv
- 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:
go-version: ${{ matrix.go }}
check-latest: true
- name: Build
run: go build -C getargv.go
- 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 }}