Skip to content

release

release #125

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: build
type: choice
options:
- major
- minor
- patch
- prerelease
- build
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 # to read the repo and tags
id-token: write # to inject the OIDC token to octo-sts
steps:
- name: Harden Runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- uses: octo-sts/action@f603d3be9d8dd9871a265776e625a27b00effe05 # v1.1.1
id: octo-sts
with:
scope: ${{ github.repository }}
identity: release
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0 # fetch all history for all tags and branches
token: ${{ steps.octo-sts.outputs.token }}
- 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@c69a264ec2a5934c3186c618f368fc1c86f16cff # v1.6.19
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>"