Skip to content

release

release #191

Workflow file for this run

name: release
on:
schedule:
- cron: '0 0 * * 1' # weekly on Monday at 00:00
workflow_dispatch:
inputs:
dry_run:
description: "dry-run mode: if true, no git tags will be pushed."
type: boolean
default: false
release_type:
description: "Type of Release"
required: true
default: patch
type: choice
options:
- major
- minor
- patch
- prerelease
forced_version:
description: "(Optional) SemVer2-compliant forced-version to tag explicitly, instead of auto-bumping.
Must not already exist"
required: false
type: string
permissions: {}
jobs:
release:
name: release
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- uses: octo-sts/action@e480437973a6f6ac2e9caa40ecabedc870d76395 # v1.0.1
id: octo-sts
with:
scope: ${{ github.repository }}
identity: release
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0 # fetch all history for all tags and branches
token: ${{ steps.octo-sts.outputs.token }}
- uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version-file: 'go.mod'
check-latest: true
- name: Check if any changes since last tag
id: check
run: |
git fetch --tags
if [ -z "$(git tag --points-at HEAD)" ]; then
echo "Nothing points at HEAD, bump a new tag"
echo "bump=yes" >> "$GITHUB_OUTPUT"
else
echo "A tag already points to head, don't bump"
echo "bump=no" >> "$GITHUB_OUTPUT"
fi
- name: Bump and push Git tag
uses: chainguard-dev/actions/git-tag@f632aec66edeebe245ad686a33a0c0a2160cac31 # v1.4.14
if: steps.check.outputs.bump == 'yes'
with:
token: ${{ steps.octo-sts.outputs.token }}
git_tag_prefix: "v"
bump_level: ${{ inputs.release_type || 'patch' }}
dry_run: ${{ inputs.dry_run || 'false'}}
forced_version: ${{ inputs.forced_version || '' }}
author: "octo-sts[bot] <157150467+octo-sts[bot]@users.noreply.github.com>"
committer: "octo-sts[bot] <157150467+octo-sts[bot]@users.noreply.github.com>"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
if: steps.check.outputs.bump == 'yes'
with:
distribution: goreleaser
version: latest
args: release --clean --parallelism 1
env:
GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}