Skip to content

Commit a6a128b

Browse files
committed
feat: add validation for mainnet deployment environment in workflow
1 parent 73c8920 commit a6a128b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/sharing-smart-contract-deploy.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,29 @@ on:
2525

2626

2727
jobs:
28+
29+
# Validate deployment network and environment.
30+
validate:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
# On Github, the environment `mainnets` is restricted to
38+
# the main branch. Here we check that it's only used with
39+
# mainnet networks.
40+
- name: Validate mainnet deployment
41+
run: |
42+
if [[ "${{ inputs.environment }}" == "mainnets" && "${{ inputs.network }}" != "bellecour" ]]; then
43+
echo "::error::mainnets environment can only be used with mainnet networks."
44+
exit 1
45+
fi
46+
echo "Deploying to network '${{ inputs.network }}' with environment '${{ inputs.environment }}'."
47+
48+
# Deploy and verify contract.
2849
build-and-test:
50+
needs: validate
2951
uses: ./.github/workflows/sharing-smart-contracts-ci.yml
3052
with:
3153
node-version: 20

0 commit comments

Comments
 (0)