|
| 1 | +name: manual-rc-release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + tag: |
| 7 | + description: 'The rc tag to create, e.g. v1.2.3-rc.1' |
| 8 | + required: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + rc-release: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + # If the e2e tests pass we automatically generate an RC release |
| 15 | + # this shouldn't happen when the release PR is merged, only when it's opened or updated |
| 16 | + - name: Create and Push RC Tag with Git |
| 17 | + id: create-push-rc-tag |
| 18 | + env: |
| 19 | + NEXT_RC_TAG: ${{ inputs.tag }} |
| 20 | + run: | |
| 21 | + # Configure git user |
| 22 | + git config user.name "${{ github.actor }}" |
| 23 | + git config user.email "${{ github.actor }}@users.noreply.github.com" |
| 24 | +
|
| 25 | + # Create and push the new tag |
| 26 | + git tag "$NEXT_RC_TAG" -m "Release Candidate $NEXT_RC_TAG" |
| 27 | + git push origin "$NEXT_RC_TAG" |
| 28 | + - name: retrieve GPG Credentials |
| 29 | + id: retrieve-gpg-credentials |
| 30 | + uses: rancher-eio/read-vault-secrets@main |
| 31 | + with: |
| 32 | + secrets: | |
| 33 | + secret/data/github/repo/${{ github.repository }}/signing/gpg passphrase | GPG_PASSPHRASE ; |
| 34 | + secret/data/github/repo/${{ github.repository }}/signing/gpg privateKeyId | GPG_KEY_ID ; |
| 35 | + secret/data/github/repo/${{ github.repository }}/signing/gpg privateKey | GPG_KEY |
| 36 | + - name: import_gpg_key |
| 37 | + id: import-gpg-key |
| 38 | + env: |
| 39 | + GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }} |
| 40 | + GPG_KEY_ID: ${{ env.GPG_KEY_ID }} |
| 41 | + GPG_KEY: ${{ env.GPG_KEY }} |
| 42 | + run: | |
| 43 | + cleanup() { |
| 44 | + # clear history just in case |
| 45 | + history -c |
| 46 | + } |
| 47 | + trap cleanup EXIT TERM |
| 48 | +
|
| 49 | + # sanitize variables |
| 50 | + if [ -z "${GPG_PASSPHRASE}" ]; then echo "gpg passphrase empty"; exit 1; fi |
| 51 | + if [ -z "${GPG_KEY_ID}" ]; then echo "key id empty"; exit 1; fi |
| 52 | + if [ -z "${GPG_KEY}" ]; then echo "key contents empty"; exit 1; fi |
| 53 | +
|
| 54 | + echo "Importing gpg key" |
| 55 | + echo "${GPG_KEY}" | gpg --import --batch > /dev/null || { echo "Failed to import GPG key"; exit 1; } |
| 56 | + - name: Run GoReleaser |
| 57 | + uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action |
| 58 | + with: |
| 59 | + args: release --clean --config .goreleaser_rc.yml |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + GPG_KEY_ID: ${{ env.GPG_KEY_ID }} |
| 63 | + GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }} |
0 commit comments