release #201
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@d6c70ad3b9ac85df6da6b9749014d7283987cfec # v1.0.3 | |
| 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@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10.0 | |
| - 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@1b32103f5aa389c31ab0be75a8edc38d7e4750d8 # v1.5.7 | |
| 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 }} |