Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
env:
GONOSUMCHECK: github.com/GoCodeAlone/*
GONOSUMDB: github.com/GoCodeAlone/*
GOPRIVATE: github.com/GoCodeAlone/*
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.26'
cache: true
- name: Configure git for private modules
run: git config --global url."https://${{ secrets.RELEASES_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Resolve dependencies
run: go mod tidy
- name: Run tests
run: go test ./... -v -race
- name: Build binaries
run: |
VERSION=${GITHUB_REF#refs/tags/}
declare -a PLATFORMS=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64")
mkdir -p bin
for platform in "${PLATFORMS[@]}"; do
os="${platform%%/*}"
arch="${platform##*/}"
output="bin/workflow-plugin-authz-${os}-${arch}"
echo "Building ${output}..."
GOOS=${os} GOARCH=${arch} go build -ldflags "-X main.version=${VERSION}" \
-o "${output}" ./cmd/workflow-plugin-authz
done
ls -la bin/
- name: Create release archives
run: |
mkdir -p dist
for binary in bin/workflow-plugin-authz-*; do
name=$(basename "${binary}")
tar -czf "dist/${name}.tar.gz" -C bin "${name}"
sha256sum "dist/${name}.tar.gz" >> dist/checksums.txt
done
cp plugin.json dist/
ls -la dist/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
dist/checksums.txt
dist/plugin.json
generate_release_notes: true
draft: false
prerelease: false