Skip to content

Commit 0d21731

Browse files
authored
feat: better securing release workflows and github actions (#482)
1 parent 00fc247 commit 0d21731

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/marketplace-publish.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
jobs:
1010
publish-stable:
1111
runs-on: ubuntu-latest
12+
environment: marketplace-production
1213
permissions:
1314
contents: write
1415

@@ -29,6 +30,13 @@ jobs:
2930
test "$package_name" = "zoo-code"
3031
test "$publisher" = "ZooCodeOrganization"
3132
33+
- name: Validate publish ref
34+
run: |
35+
if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ] && [ "$GITHUB_REF_NAME" != "main" ]; then
36+
echo "Manual stable publishes must run from main, not ${GITHUB_REF_NAME}."
37+
exit 1
38+
fi
39+
3240
- name: Validate release tag
3341
if: github.event_name == 'push'
3442
run: |

.github/workflows/nightly-publish.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ concurrency:
1515
jobs:
1616
publish-prerelease:
1717
runs-on: ubuntu-latest
18+
environment: marketplace-prerelease
1819

1920
steps:
2021
- name: Checkout code
@@ -33,6 +34,13 @@ jobs:
3334
test "$package_name" = "zoo-code"
3435
test "$publisher" = "ZooCodeOrganization"
3536
37+
- name: Validate publish ref
38+
run: |
39+
if [ "$GITHUB_REF_NAME" != "main" ]; then
40+
echo "Pre-release publishes must run from main, not ${GITHUB_REF_NAME}."
41+
exit 1
42+
fi
43+
3644
- name: Set pre-release version
3745
id: version
3846
env:

0 commit comments

Comments
 (0)