Skip to content

Commit fe8c50c

Browse files
fix: add manual rc release and update permissions (#1749)
Signed-off-by: matttrach <[email protected]> Co-authored-by: Matt Trachier <[email protected]>
1 parent 788d9eb commit fe8c50c

File tree

4 files changed

+73
-6
lines changed

4 files changed

+73
-6
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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 }}

.github/workflows/release.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@ env:
1313
AWS_MAX_ATTEMPTS: 100
1414
AWS_RETRY_MODE: adaptive
1515

16+
permissions:
17+
contents: write
18+
id-token: write
19+
issues: write
20+
pull-requests: write
21+
actions: read
22+
1623
jobs:
1724
release:
1825
runs-on: ubuntu-latest
1926
outputs:
2027
release_pr: ${{ steps.release-please.outputs.pr }}
2128
release_version: ${{ steps.release-please.outputs.version }}
22-
permissions:
23-
contents: write
24-
id-token: write
25-
issues: write
26-
pull-requests: write
27-
actions: read
2829
steps:
2930
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
3031
with:

.goreleaser_rc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ builds:
2727
ignore:
2828
- goos: windows
2929
goarch: arm
30+
- goos: windows
31+
goarch: arm64
3032
archives:
3133
- formats: [ 'zip' ]
3234
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'

aspell_custom.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pre
1616
pre-release
1717
prerelease
1818
rancher
19+
rc
1920
rke
2021
rke2
2122
terraform

0 commit comments

Comments
 (0)