Release v1.5.1 #363
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go | |
on: | |
push: | |
branches: [ "main", "dev" ] | |
paths-ignore: | |
- 'README.md' | |
pull_request: | |
branches: [ "main", "dev" ] | |
types: [opened, synchronize, reopened, ready_for_review] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && !github.event.pull_request.draft) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: ['1.19', '1.20', '1.21'] | |
os: [ 'linux', 'windows', 'darwin' ] | |
arch: [ 'amd64', 'arm64' ] | |
outputs: | |
commit-hash: ${{ steps.get_commit.outputs.commit }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Build | |
env: | |
GOOS: ${{ matrix.os }} | |
GOARCH: ${{ matrix.arch }} | |
run: go build -v ./... | |
update-version: | |
needs: build | |
if: github.ref == 'refs/heads/dev' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: 'dev' | |
- name: Update Version in config.go | |
run: | | |
sed -i "s/const Version = \".*\"/const Version = \"$GITHUB_SHA\"/" config/config.go | |
- name: Commit and Push | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github Action" | |
git add config/config.go | |
git commit -m "Update dev version to $GITHUB_SHA" | |
git push origin HEAD:dev |