Skip to content

Bump the gomod-patch-and-minor group across 1 directory with 3 updates #54

Bump the gomod-patch-and-minor group across 1 directory with 3 updates

Bump the gomod-patch-and-minor group across 1 directory with 3 updates #54

Workflow file for this run

name: CI
permissions:
contents: read
on:
push:
branches: [ main ]
tags:
# Run on all tags except for release tags (e.g. v1.2.3)
- '!v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches: [ main ]
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Cache Go modules
uses: actions/cache@v5
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Install tools
run: go install github.com/golang-migrate/migrate/v4/cmd/migrate@latest
- name: Run tests
run: go test ./... -v
build:
name: Build binary with version
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Compute version and git sha
id: ver
run: |
echo "GITHUB_REF=${GITHUB_REF}"
GIT_SHA=$(git rev-parse --short=8 HEAD)
echo "git_sha=$GIT_SHA" >> $GITHUB_OUTPUT
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
echo "tag=$TAG" >> $GITHUB_OUTPUT
# Version string: <tag> (sha)
VERSION="$TAG ($GIT_SHA)"
else
VERSION="$GIT_SHA"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build
run: |
echo "Building with version ${{ steps.ver.outputs.version }} (git ${GITHUB_SHA::8})"
BUILD_DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
go build -ldflags "-X main.version='${{ steps.ver.outputs.version }}' -X main.gitCommit='${{ steps.ver.outputs.git_sha }}' -X main.buildDate='${BUILD_DATE}'" -o keymaster ./cmd/keymaster
- name: Upload binary
uses: actions/upload-artifact@v6
with:
name: keymaster-${{ steps.ver.outputs.version }}
path: keymaster