Skip to content

Merge pull request #98 from pr-cli/docs/mvp-release-readiness #2

Merge pull request #98 from pr-cli/docs/mvp-release-readiness

Merge pull request #98 from pr-cli/docs/mvp-release-readiness #2

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version string for manual dry-run builds"
required: false
default: "manual"
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
package:
name: Package (${{ matrix.goos }}/${{ matrix.goarch }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
archive: tar.gz
- goos: linux
goarch: arm64
archive: tar.gz
- goos: darwin
goarch: amd64
archive: tar.gz
- goos: darwin
goarch: arm64
archive: tar.gz
- goos: windows
goarch: amd64
archive: zip
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: "stable"
cache: false
- name: Build package
env:
CGO_ENABLED: "0"
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
VERSION_INPUT: ${{ github.event.inputs.version }}
run: |
set -euo pipefail
version="$GITHUB_REF_NAME"
if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ] && [ -n "$VERSION_INPUT" ]; then
version="$VERSION_INPUT"
fi
package="prmaven-${version}-${GOOS}-${GOARCH}"
mkdir -p "dist/${package}"
binary="prmaven"
if [ "$GOOS" = "windows" ]; then
binary="prmaven.exe"
fi
go build -trimpath -ldflags="-s -w -X main.version=${version}" -o "dist/${package}/${binary}" ./cmd/prmaven
cp README.md LICENSE "dist/${package}/"
cd dist
if [ "${{ matrix.archive }}" = "zip" ]; then
zip -r "${package}.zip" "$package"
else
tar -czf "${package}.tar.gz" "$package"
fi
sha256sum "${package}.${{ matrix.archive }}" > "${package}.${{ matrix.archive }}.sha256"
- name: Upload package artifacts
uses: actions/upload-artifact@v7
with:
name: prmaven-${{ matrix.goos }}-${{ matrix.goarch }}
path: |
dist/*.tar.gz
dist/*.zip
dist/*.sha256
release:
name: Publish GitHub release
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
needs:
- package
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Publish release
uses: softprops/action-gh-release@v3
with:
files: |
dist/*.tar.gz
dist/*.zip
dist/*.sha256
generate_release_notes: true