Skip to content

chore(release): v1.4.0 #5

chore(release): v1.4.0

chore(release): v1.4.0 #5

Workflow file for this run

name: release
# Cut a GitHub release with cross-platform binaries whenever a v* tag is pushed:
# git tag -a v1.2.3 -m "postgres4all v1.2.3" && git push origin v1.2.3
# The tag drives the version (injected via -ldflags), so no manual main.go bump is needed.
on:
push:
tags:
- 'v*'
permissions:
contents: write # required to create the release
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Test
run: go test ./...
- name: Build cross-platform binaries
env:
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
VERSION="${TAG#v}"
mkdir -p dist
build() { # build <goos> <goarch> <ext>
local out="dist/postgres4all_${VERSION}_$1_$2$3"
GOOS="$1" GOARCH="$2" CGO_ENABLED=0 \
go build -ldflags "-s -w -X main.version=${VERSION}" -o "$out" ./cmd/postgres4all
echo "built $out"
}
build linux amd64 ""
build linux arm64 ""
build darwin amd64 ""
build darwin arm64 ""
build windows amd64 ".exe"
( cd dist && sha256sum * > checksums.txt )
ls -lh dist
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }} # via env (not inline ${{ }}) to avoid shell injection
run: |
gh release create "$TAG" \
--title "postgres4all $TAG" \
--generate-notes \
dist/*