Skip to content
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

Add support for deployment on Goerli testnet #114

Merged
merged 9 commits into from
Aug 3, 2022
24 changes: 7 additions & 17 deletions .github/workflows/contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:

contracts-deployment-testnet:
needs: [contracts-build-and-test]
if: github.event_name == 'workflow_dispatch'
if: github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'goerli'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add && github.event.inputs.environment == 'goerli'?
It's a manual workflow dispatch step, so maybe we could skip it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could. Generally, right now we only support goerli and we expect that the workflow is dispatched with this environment. I introduced github.event.inputs.environment == 'goerli' condition to not run the deploy job if workflow gets accidentally run on different environment. But even without this condition we don't risk publishing of a package with some invalid contracts - deploy will fail either due to unsupported environment or due to incorrect account being used.
Actually, returning error instead of cleanly exiting the workflow may be a better idea in case wrong environment is provided - I will remove this environment check...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -113,29 +113,19 @@ jobs:
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Get upstream packages versions
uses: keep-network/ci/actions/upstream-builds-query@v1
id: upstream-builds-query
with:
upstream-builds: ${{ github.event.inputs.upstream_builds }}
query: keep-core-contracts-version = github.com/keep-network/keep-core/solidity-v1#version

- name: Resolve latest contracts
run: |
yarn upgrade \
@keep-network/keep-core@${{ steps.upstream-builds-query.outputs.keep-core-contracts-version }}
run: yarn upgrade @keep-network/[email protected]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we get a package that is tagged with the environment name?

Suggested change
run: yarn upgrade @keep-network/keep-core@1.8.1-goerli.0
run: yarn upgrade @keep-network/keep-core@${{ github.event.inputs.environment }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can. Resolving keep-core dependency using goerli tag did not work for me in another project, but here apparently it works fine. Changed in c9f33ca.


- name: Configure tenderly
if: github.event.inputs.environment == 'ropsten'
env:
TENDERLY_TOKEN: ${{ secrets.TENDERLY_TOKEN }}
run: ./config_tenderly.sh

- name: Deploy contracts
env:
CHAIN_API_URL: ${{ secrets.ROPSTEN_ETH_HOSTNAME_HTTP }}
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.ROPSTEN_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.ROPSTEN_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY: ${{ secrets.GOERLI_KEEP_ETH_CONTRACT_OWNER_PRIVATE_KEY }}
run: yarn deploy --network ${{ github.event.inputs.environment }}

- name: Bump up package version
Expand All @@ -152,7 +142,7 @@ jobs:
run: npm publish --access=public --network=${{ github.event.inputs.environment }} --tag ${{ github.event.inputs.environment }}

- name: Notify CI about completion of the workflow
uses: keep-network/ci/actions/notify-workflow-completed@v1
uses: keep-network/ci/actions/notify-workflow-completed@v2
env:
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -201,7 +191,7 @@ jobs:
- name: Verify contracts on Etherscan
env:
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
CHAIN_API_URL: ${{ secrets.ROPSTEN_ETH_HOSTNAME_HTTP }}
CHAIN_API_URL: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
run: |
yarn run hardhat --network ${{ github.event.inputs.environment }} \
etherscan-verify --license GPL-3.0 --force-license
Expand Down