Skip to content

Commit 1c5c65e

Browse files
committed
Add action to deploy sharing contract
1 parent 7fe87f8 commit 1c5c65e

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Sharing Smart Contract - Deployment
2+
3+
on:
4+
workflow_dispatch: # Manual trigger
5+
inputs:
6+
network:
7+
description: 'Network'
8+
required: true
9+
type: choice
10+
options:
11+
- hardhat
12+
- avalancheFujiTestnet
13+
- arbitrumSepolia
14+
- bellecour
15+
default: 'hardhat'
16+
environment:
17+
description: 'Environment'
18+
required: true
19+
type: choice
20+
options:
21+
- testnets
22+
- mainnets
23+
default: 'testnets'
24+
25+
jobs:
26+
27+
# Validate deployment network and environment.
28+
validate:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0
34+
- name: Validate mainnet deployment conditions
35+
# Use `mainnets` environment (wallet) only for mainnet deployments
36+
# and only from the main branch.
37+
# TODO update this when we have other mainnets
38+
run: |
39+
if [[ \
40+
"${{ inputs.environment }}" == "mainnets" && \
41+
!("${{ inputs.network }}" == "bellecour" && "${{ github.ref }}" == "refs/heads/main") \
42+
]]; then
43+
echo "::error::Bellecour mainnet deployments must be made from the main branch. Current branch: ${GITHUB_REF#refs/heads/}"
44+
exit 1
45+
fi
46+
echo "Deployment validated!"
47+
48+
# Build and test before deploying.
49+
ci:
50+
needs: validate
51+
uses: ./.github/workflows/sharing-smart-contracts-reusable.yml
52+
with:
53+
node-version: 18
54+
55+
# Run deployment steps.
56+
deploy:
57+
needs: ci
58+
runs-on: ubuntu-latest
59+
permissions:
60+
contents: write # Required for saving deployment
61+
environment: ${{ inputs.environment }}
62+
steps:
63+
- name: Say Hello
64+
run: echo "Hello from env - ${{ inputs.environment }}"
65+
66+
# - uses: actions/checkout@v4
67+
# with:
68+
# fetch-depth: 0
69+
70+
# - uses: actions/setup-node@v4
71+
# with:
72+
# node-version: 18
73+
# cache: 'npm' # Cache dependencies
74+
75+
# - name: Install dependencies
76+
# run: npm ci
77+
78+
# - name: Set environment variables
79+
# id: set-env
80+
# run: |
81+
# echo "PRIVATE_KEY=${{ secrets.PRIVATE_KEY }}" >> $GITHUB_ENV
82+
# if [ "${{ inputs.network }}" == "avalancheFujiTestnet" ]; then
83+
# echo "FUJI_RPC_URL=${{ secrets.FUJI_RPC_URL }}" >> $GITHUB_ENV
84+
# echo "SNOWTRACE_API_KEY=${{ secrets.SNOWTRACE_API_KEY }}" >> $GITHUB_ENV
85+
# fi
86+
87+
# if [ "${{ inputs.network }}" == "arbitrumSepolia" ]; then
88+
# echo "ARBITRUM_SEPOLIA_RPC_URL=${{ secrets.ARBITRUM_SEPOLIA_RPC_URL }}" >> $GITHUB_ENV
89+
# echo "ARBISCAN_API_KEY=${{ secrets.ARBISCAN_API_KEY }}" >> $GITHUB_ENV
90+
# fi
91+
92+
# if [ "${{ inputs.network }}" == "bellecour" ]; then
93+
# echo "BELLECOUR_RPC_URL=${{ secrets.BELLECOUR_RPC_URL }}" >> $GITHUB_ENV
94+
# fi
95+
96+
# - name: Deploy contracts
97+
# run: |
98+
# echo "Deploying to: ${{ inputs.network }} with ${{ inputs.environment }} environment"
99+
# npm run deploy -- --network ${{ inputs.network }}
100+
101+
# - name: Update config.json with ERC1538Proxy address
102+
# if: inputs.network != 'hardhat'
103+
# run: npx hardhat run scripts/tools/update-config.ts --network ${{ inputs.network }}
104+
105+
# - name: Save deployment artifacts and updated config
106+
# if: inputs.network != 'hardhat'
107+
# uses: stefanzweifel/git-auto-commit-action@v5
108+
# with:
109+
# commit_message: 'chore: save deployment artifacts for ${{ inputs.network }} (${{ inputs.environment }}, ${{ github.run_id }})'
110+
# file_pattern: 'deployments/${{ inputs.network }}/* config/config.json'
111+
# commit_user_name: 'GitHub Actions Bot'
112+
# commit_user_email: 'github-actions[bot]@users.noreply.github.com'
113+
# commit_author: 'GitHub Actions Bot <github-actions[bot]@users.noreply.github.com>'

0 commit comments

Comments
 (0)