Skip to content

Commit ee9311f

Browse files
fix: ensure the correct workflow, users, and tags (#1775)
Signed-off-by: matttrach <[email protected]> Co-authored-by: Matt Trachier <[email protected]>
1 parent 3a7a325 commit ee9311f

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

.github/workflows/manual-rc-release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ jobs:
1919
rc-release:
2020
runs-on: ubuntu-latest
2121
steps:
22+
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script/commits/main
23+
id: check-user-in-maintainers
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
script: |
28+
const isMaintainer = ${{ vars.TERRAFORM_MAINTAINERS }}.includes(context.actor);
29+
return isMaintainer;
30+
- run: |
31+
# if the tag doesn't contain "rc" we should not be in this workflow
32+
if grep -q "rc" <<< "${{ inputs.tag }}"; then
33+
echo "Tag contains 'rc', continuing with RC release"
34+
else
35+
echo "Tag doesn't contain 'rc', please use the manual-release workflow"
36+
exit 1
37+
fi
2238
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
2339
with:
2440
fetch-depth: 0

.github/workflows/manual-release.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ jobs:
1919
release:
2020
runs-on: ubuntu-latest
2121
steps:
22+
- uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 https://github.com/actions/github-script/commits/main
23+
id: check-user-in-maintainers
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
script: |
28+
const isMaintainer = ${{ vars.TERRAFORM_MAINTAINERS }}.includes(context.actor);
29+
return isMaintainer;
30+
- run: |
31+
# if the tag contains "rc" we should not be in this workflow
32+
if grep -q "rc" <<< "${{ inputs.tag }}"; then
33+
echo "Tag contains 'rc', please use the manual-rc-release workflow"
34+
exit 1
35+
fi
2236
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout
2337
with:
2438
fetch-depth: 0
@@ -41,6 +55,11 @@ jobs:
4155
with:
4256
ref: ${{ inputs.tag }}
4357
path: ${{ github.workspace }}/tags/${{ inputs.tag }}
58+
- run: |
59+
# remove any tags that are not the one specified (to avoid goreleaser confusion)
60+
cd "${{ github.workspace }}/tags/${{ inputs.tag }}"
61+
git tag | grep -v "${{ inputs.tag }}" | xargs git tag -d
62+
cd ../../
4463
- name: retrieve GPG Credentials
4564
id: retrieve-gpg-credentials
4665
uses: rancher-eio/read-vault-secrets@main

0 commit comments

Comments
 (0)