Skip to content

release

release #26

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
concurrency:
group: stencil-release-${{ github.head_ref }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- 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
- 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
- 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 }}
- uses: fregante/setup-git-user@v2
- uses: anchore/sbom-action/download-syft@v0.16.0
# 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: Wait for manual approval
uses: trstringer/manual-approval@v1
# Skip if the triggering actor is the same as the approver
if: github.triggering_actor != 'jaredallard'
with:
secret: ${{ secrets.GITHUB_TOKEN }}
approvers: "jaredallard"
issue-title: "Release ${{ steps.next_version.outputs.version }}"
- 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:
BUILD_RC: ${{ github.event.inputs.rc }}
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 }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.homebrew-tap-github-app.outputs.token }}