split build / release jobs #32
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: Build - Continuous | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21.x' | |
- name: Dependencies | |
run: | | |
go get . | |
- name: Build Info | |
run: | | |
echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_ENV" | |
echo "GIT_HASH=$(git rev-parse --verify HEAD)" >> "$GITHUB_ENV" | |
echo "GIT_DIRTY=$(git diff --quiet; [ $? -eq 0 ] && echo false || echo true)" >> "$GITHUB_ENV" | |
- name: Build | |
run: | | |
CGO_ENABLED=0 go build -ldflags "-X main.gitBranch=$GIT_BRANCH -X main.gitHash=$GIT_HASH -X main.gitDirty=$GIT_DIRTY" | |
- name: Tag Latest | |
run: | | |
git tag latest --force | |
git push origin latest --force |