Release v0.0.5 (skip tests: false, use existing tag: false) #7
This file contains 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: 'New Release' | |
run-name: 'Release ${{ inputs.version_number }} (skip tests: ${{ inputs.skip_tests }}, use existing tag: ${{ inputs.use_existing_tag}})' | |
# Used for creating a new release. This workflow will run qa acceptance tests, create a new tag, and generate the release with GoReleaser. | |
on: | |
workflow_dispatch: | |
inputs: | |
version_number: | |
description: 'Version number (e.g., v1.0.0, v1.0.0-pre, v1.0.0-pre1)' | |
required: true | |
skip_tests: | |
description: 'Set value to `true` to skip tests, default is `false`' | |
default: 'false' | |
use_existing_tag: | |
description: 'Set value to `true` to use an existing tag for the release process, default is `false`' | |
default: 'false' | |
jobs: | |
create-tag: | |
runs-on: ubuntu-latest | |
if: >- | |
!cancelled() | |
&& inputs.use_existing_tag == 'false' | |
steps: | |
- name: Validation of version format | |
run: | | |
echo "${{ inputs.version_number }}" | grep -P '^v\d+\.\d+\.\d+(-pre[A-Za-z0-9-]*)?$' | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
- name: Get the latest commit SHA | |
id: get-sha | |
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
- name: Create release tag | |
uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 | |
with: | |
tag: ${{ inputs.version_number }} | |
commit_sha: ${{ steps.get-sha.outputs.sha }} | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg_passphrase: ${{ secrets.PASSPHRASE }} | |
- name: Create Issue | |
if: ${{ failure() }} | |
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
labels: failed-release | |
title: "Releasing foascli v${{ inputs.version_number }} failed at the tag creation step :scream_cat:" | |
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
run-tests: | |
needs: [ create-tag ] | |
if: >- | |
!cancelled() | |
&& !contains(needs.*.result, 'failure') | |
&& inputs.skip_tests == 'false' | |
secrets: inherit | |
uses: ./.github/workflows/code-health-tools.yml | |
release: | |
runs-on: ubuntu-latest | |
needs: [ run-tests ] | |
# Release is skipped if there are failures in previous steps | |
if: >- | |
!cancelled() | |
&& !contains(needs.*.result, 'failure') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
with: | |
ref: ${{ inputs.version_number }} | |
- name: Set up Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 | |
with: | |
go-version-file: 'tools/cli/go.mod' | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 | |
with: | |
version: '~> v2' | |
workdir: tools/cli | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Issue | |
if: ${{ failure() }} | |
uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
labels: failed-release | |
title: "Releasing foascli ${{ inputs.version_number }} failed at the goreleaser step :scream_cat:" | |
body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |