-
Notifications
You must be signed in to change notification settings - Fork 10
feat(sharing): Deploy DPS contract using Github action #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
7fe87f8
1c5c65e
9246b87
ffca818
763f876
47dcd99
0c430d0
237aa32
0839d20
5f41095
51a69cc
efb8932
c92d3ab
05da051
e88a8cb
aec63e3
35b77ba
31fce84
b483668
df8aba7
b72632f
1af9e02
e3c8950
479974d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| name: Sharing Smart Contract - Deployment | ||
|
|
||
| on: | ||
| workflow_dispatch: # Manual trigger | ||
| inputs: | ||
| network: | ||
| description: 'Network' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - hardhat | ||
| - avalancheFujiTestnet | ||
| - arbitrumSepolia | ||
| - bellecour | ||
| default: 'hardhat' | ||
| environment: | ||
| description: 'Environment' | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - testnets | ||
| - mainnets | ||
| default: 'testnets' | ||
|
|
||
| jobs: | ||
|
|
||
| # Validate deployment network and environment. | ||
| validate: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| # On Github, the environment `mainnets` is restricted to | ||
| # the main branch. Here we check that it's only used with | ||
| # mainnet networks. | ||
| - name: Validate mainnet deployment | ||
| run: | | ||
| if [[ "${{ inputs.environment }}" == "mainnets" && "${{ inputs.network }}" != "bellecour" ]]; then | ||
| echo "::error::mainnets environment can only be used with mainnet networks." | ||
| exit 1 | ||
| fi | ||
| echo "Deploying to network '${{ inputs.network }}' with environment '${{ inputs.environment }}'." | ||
|
|
||
| # Build and test before deploying. | ||
| ci: | ||
| needs: validate | ||
| uses: ./.github/workflows/sharing-smart-contracts-reusable.yml | ||
| with: | ||
| node-version: 18 | ||
|
|
||
| # Deploy and verify contract. | ||
| deploy: | ||
| needs: ci | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write # Required to commit deployment files. | ||
| environment: ${{ inputs.environment }} | ||
| steps: | ||
| - name: Set environment variables | ||
| id: set-env | ||
| run: | | ||
| echo "PRIVATE_KEY=${{ secrets.PRIVATE_KEY }}" >> $GITHUB_ENV | ||
|
|
||
| if [ "${{ inputs.network }}" == "arbitrumSepolia" ]; then | ||
| echo "POCO_ADDRESS=0x14B465079537655E1662F012e99EBa3863c8B9E0" >> $GITHUB_ENV | ||
| echo "DATASET_REGISTRY_ADDRESS=0x3441A0C9FE488c51fcABa2bAAA048720f4D4F72D" >> $GITHUB_ENV | ||
| echo "ARBISCAN_API_KEY=${{ secrets.ARBISCAN_API_KEY }}" >> $GITHUB_ENV | ||
| fi | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 18 | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: packages/sharing-smart-contract | ||
| run: npm ci | ||
|
|
||
| - name: Install Foundry | ||
| uses: foundry-rs/foundry-toolchain@v1 | ||
| with: | ||
| version: stable | ||
| cache: true | ||
|
|
||
| - name: Deploy contracts | ||
| working-directory: packages/sharing-smart-contract | ||
| run: npm run deploy -- --network ${{ inputs.network }} | ||
|
|
||
| - name: Save deployment artifacts | ||
| if: inputs.network != 'hardhat' | ||
| uses: stefanzweifel/git-auto-commit-action@v5 | ||
| with: | ||
| commit_message: 'chore: save deployment artifacts for ${{ inputs.network }} (${{ inputs.environment }}, ${{ github.run_id }})' | ||
| file_pattern: 'packages/sharing-smart-contract/ignition/deployments/* packages/sharing-smart-contract/.openzeppelin/*' | ||
| commit_user_name: 'GitHub Actions Bot' | ||
| commit_user_email: 'github-actions[bot]@users.noreply.github.com' | ||
| commit_author: 'GitHub Actions Bot <github-actions[bot]@users.noreply.github.com>' | ||
|
|
||
| # TODO | ||
| - name: Verify contracts | ||
| working-directory: packages/sharing-smart-contract | ||
| run: echo "Verify contracts" # npm run verify:ignition -- <deploymentId> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,3 +15,5 @@ RPC_URL= | |
|
|
||
| ## Mnemonic for the network | ||
| MNEMONIC= | ||
|
|
||
| ETHERSCAN_API_KEY= | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| # Hardhat files | ||
| cache | ||
| artifacts | ||
| !ignition/deployments/**/artifacts | ||
|
|
||
| # TypeChain files | ||
| typechain | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| "scripts": { | ||
| "clean": "hardhat clean", | ||
| "compile": "hardhat clean && hardhat compile && npm run artifact-to-abis", | ||
| "verify:ignition": "hardhat ignition verify --include-unrelated-contracts", | ||
| "verify": "hardhat verify", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we keep both script ? or only use verify:ignition as default and rename it to "verify" ?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think HH Ignition verification is enough. For example, when we upgrade proxies, the new implementation contracts is deployed by |
||
| "deploy": "hardhat run scripts/deploy.js", | ||
| "update-env": "hardhat run ./scripts/updateEnv.js", | ||
|
|
@@ -57,4 +58,4 @@ | |
| "iexec": "^8.15.0", | ||
| "rimraf": "^6.0.1" | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.