Skip to content

Release

Release #66

Workflow file for this run

name: Release
on:
schedule:
- cron: '0 0 * * 1' # every Monday at 00:00 UTC
workflow_dispatch:
jobs:
release:
name: Release
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow
permissions:
id-token: write
contents: write
steps:
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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, so we need a new tag+release."
echo "need_release=yes" >> $GITHUB_OUTPUT
else
echo "A tag already points to head, no need for a new tag+release."
echo "need_release=no" >> $GITHUB_OUTPUT
fi
- name: Bump version and push tag
id: create_tag
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2
if: steps.check.outputs.need_release == 'yes'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
if: steps.check.outputs.need_release == 'yes'
with:
ref: ${{ steps.create_tag.outputs.new_tag }}
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
if: steps.check.outputs.need_release == 'yes'
with:
go-version-file: './go.mod'
check-latest: true
# Cosign is used by goreleaser to sign release artifacts.
- uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
if: steps.check.outputs.need_release == 'yes'
- uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
if: steps.check.outputs.need_release == 'yes'
with:
version: latest
install-only: true
# Federate to create a token to authenticate with the homebrew-tap repository.
- uses: octo-sts/action@6177b4481c00308b3839969c3eca88c96a91775f # v1.0.0
if: steps.check.outputs.need_release == 'yes'
id: octo-sts
with:
scope: chainguard-dev/homebrew-tap
identity: melange
- name: Release
if: steps.check.outputs.need_release == 'yes'
run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }}