Skip to content

release

release #46

Workflow file for this run

name: release
on:
# Only run when triggered through the Github UI or API.
workflow_dispatch:
inputs:
rc:
description: "Build a release candidate instead of a stable release"
required: false
default: false
type: boolean
version:
description: "Set a specific version to release, defaults to automatic versioning based on conventional commits"
required: false
default: ""
type: string
permissions:
contents: write
packages: write
issues: write
# Below are required for attestations
id-token: write
attestations: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
steps:
## <<Stencil::Block(releaseSetup)>>
- uses: actions/create-github-app-token@v1
id: homebrew-tap-github-app
with:
# https://github.com/organizations/rgst-io/settings/apps/rgst-io-stencil-homebrew
app-id: 885121
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: homebrew-tap
## <</Stencil::Block>>
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: jdx/mise-action@v2
with:
experimental: true
env:
GH_TOKEN: ${{ github.token }}
- name: Get Go directories
id: go
run: |
echo "cache_dir=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
echo "mod_cache_dir=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ${{ steps.go.outputs.cache_dir }}
key: ${{ runner.os }}-go-build-cache-rel-${{ hashFiles('**/go.sum') }}
- uses: actions/cache@v4
with:
path: ${{ steps.go.outputs.mod_cache_dir }}
key: ${{ runner.os }}-go-mod-cache-${{ hashFiles('go.sum') }}
- name: Retrieve goreleaser version
run: |-
echo "version=$(mise current goreleaser)" >> "$GITHUB_OUTPUT"
id: goreleaser
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up git user
uses: fregante/setup-git-user@v2
- name: Download syft (SBOM)
uses: anchore/sbom-action/download-syft@v0.17.8
# Bumping logic
- name: Get next version
id: next_version
env:
BUILD_RC: ${{ github.event.inputs.rc }}
VERSION_OVERRIDE: ${{ github.event.inputs.version }}
run: |-
echo "version=$(./.github/scripts/get-next-version.sh)" >> "$GITHUB_OUTPUT"
- name: Create Tag
run: |-
git tag -a "${{ steps.next_version.outputs.version }}" -m "Release ${{ steps.next_version.outputs.version }}"
- name: Generate CHANGELOG
run: |-
mise run changelog-release
- name: Create release artifacts and Github Release
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: v${{ steps.goreleaser.outputs.version }}
args: release --release-notes CHANGELOG.md --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
## <<Stencil::Block(goreleaseEnvVars)>>
BUILD_RC: ${{ github.event.inputs.rc }}
FURY_PUSH_TOKEN: ${{ secrets.FURY_PUSH_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.homebrew-tap-github-app.outputs.token }}
MACOS_SIGN_P12: ${{ secrets.MACOS_SIGN_P12 }}
MACOS_SIGN_PASSWORD: ${{ secrets.MACOS_SIGN_PASSWORD }}
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
## <</Stencil::Block>>
- uses: actions/attest-build-provenance@v2
with:
# We attest all generated _archives_ because those are what we
# upload to Github Releases.
subject-path: dist/stencil_*.*, dist/checksums.txt