Skip to content

Cut Release

Cut Release #60

Workflow file for this run

name: Cut Release
on:
workflow_dispatch:
permissions:
contents: read
env:
VERSION_FILE: pkg/version/version.go
jobs:
tag:
if: ${{ github.repository }} == 'chainguard-dev/malcontent'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- uses: chainguard-dev/actions/setup-gitsign@b479012116eacde7f895586c17b598f7ba0ee700
- name: Set up Octo-STS
uses: octo-sts/action@d6c70ad3b9ac85df6da6b9749014d7283987cfec # v1.0.3
id: octo-sts
with:
scope: chainguard-dev/malcontent
identity: release
- name: Get Version
id: get-version
run: |
VERSION=$(awk -F'"' '/ID string =/ {print $2}' "${VERSION_FILE}")
if [[ ! "${VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: VERSION is not a valid semver"
exit 1
fi
echo "VERSION=${VERSION}" >> "${GITHUB_OUTPUT}"
- name: Create Release
env:
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
VERSION: ${{ steps.get-version.outputs.VERSION }}
if: ${{ steps.get-version.outputs.VERSION != '' }}
run: |
if [[ ! "${VERSION}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: VERSION is not a valid semver"
exit 1
fi
git config --global tag.gpgsign true
gh release create "${VERSION}" --title "${VERSION}" --notes "Release ${VERSION}" --draft