Skip to content

split build / release jobs #32

split build / release jobs

split build / release jobs #32

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