Skip to content

Merge pull request #128 from sudo-bmitch/pr-update-20251019 #264

Merge pull request #128 from sudo-bmitch/pr-update-20251019

Merge pull request #128 from sudo-bmitch/pr-update-20251019 #264

Workflow file for this run

name: Go
on:
push:
branches:
- 'main'
- 'feature/**'
tags:
- 'v*.*.*'
pull_request:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
RELEASE_GO_VER: "1.25"
steps:
- name: "Set up Go ${{ env.RELEASE_GO_VER }}"
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: "${{ env.RELEASE_GO_VER }}"
check-latest: true
id: go
- name: Check out code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Verify go fmt
run: test -z "$(go fmt ./...)"
- name: Verify go vet
run: test -z "$(go vet ./...)"
- name: Test
env:
GITHUB_TOKEN: ${{ secrets.GH_RO_TOKEN }}
run: make test
- name: Linting
run: make lint
- name: Build artifacts
if: startsWith( github.ref, 'refs/tags/v' ) || github.ref == 'refs/heads/main'
run: make artifacts
- name: Gather release details
if: startsWith( github.ref, 'refs/tags/v' ) && github.repository_owner == 'sudo-bmitch'
id: release_details
run: |
VERSION=${GITHUB_REF#refs/tags/}
VALID_RELEASE=false
if [ -f "release.md" ] && grep -q "Release $VERSION" release.md; then
VALID_RELEASE=true
fi
RELEASE_NOTES=$(cat release.md || echo release notes unavailable)
# escape % and linefeeds
RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}"
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}"
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}"
echo "valid=${VALID_RELEASE}" >>$GITHUB_OUTPUT
echo "version=${VERSION}" >>$GITHUB_OUTPUT
echo "release_notes=${RELEASE_NOTES}" >>$GITHUB_OUTPUT
- name: Create release
if: steps.release_details.outputs.valid == 'true'
id: release_create
uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 # v2.4.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_details.outputs.version }}
body: ${{ steps.release_details.outputs.release_notes }}
draft: false
prerelease: false
files: |
./artifacts/version-bump-darwin-amd64
./artifacts/version-bump-linux-amd64
./artifacts/version-bump-linux-arm64
./artifacts/version-bump-linux-ppc64le
./artifacts/version-bump-linux-s390x
./artifacts/version-bump-windows-amd64.exe
- name: Save artifacts
if: github.ref == 'refs/heads/main'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: binaries
path: ./artifacts/
retention-days: 7