Merge pull request #296 from eonian-core/adjust-vault-debt-ratio-script #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Protocol to Mainnet | |
on: | |
workflow_dispatch: | |
inputs: | |
debug: | |
description: 'Value for DEBUG variable' | |
required: false | |
type: string | |
push: | |
branches: | |
- main | |
- staging | |
- development | |
paths: | |
- "packages/contracts/**" | |
env: | |
BSC_MAINNET_RPC_URL: ${{ vars.BSC_MAINNET_RPC_URL }} | |
jobs: | |
deploy: | |
name: Deploy Protocol | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ github.ref_name }} | |
env: | |
HARDHAT_NETWORK: ${{ vars.HARDHAT_NETWORK }} # bsc_mainnet_dev or bsc_mainnet_staging or bsc_mainnet_prod | |
BSCSCAN_API_KEY: ${{ secrets.BSCSCAN_API_KEY }} # Setting ETHERSCAN_API_KEY can cause issues | |
SAFE_WALLET_DEPLOY: ${{ vars.SAFE_WALLET_DEPLOY }} | |
SAFE_WALLET_ADDRESS: ${{ vars.SAFE_WALLET_ADDRESS }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# fix for EndBug/add-and-commit | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.head_ref }} | |
token: ${{ secrets.CI_GITHUB_TOKEN }} | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: Install dependencies | |
run: yarn --ignore-scripts | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly-e15e33a07c0920189fc336391f538c3dad53da73 # https://github.com/foundry-rs/foundry/releases/tag/nightly-e15e33a07c0920189fc336391f538c3dad53da73 | |
# Need for hardhat scripts | |
- name: Link packages | |
run: yarn | |
- name: Build contracts | |
run: |- | |
cd packages/contracts | |
yarn build | |
- name: Deploy Protocol | |
env: | |
DEBUG: ${{ inputs.debug }} | |
BSC_MAINNET_PRIVATE_KEY: ${{ secrets.BSC_MAINNET_PRIVATE_KEY }} | |
run: |- | |
cd packages/contracts | |
yarn hardhat deploy --network ${{ vars.HARDHAT_NETWORK }} | |
- name: Commit and push changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: Eonian CI/CD Bot | |
author_email: automation@eonian.finance | |
default_author: user_info | |
message: '[skip ci] Deployed contracts to ${{ vars.HARDHAT_NETWORK }} Mainnet' | |
fetch: --no-tags --recurse-submodules=no # Prevent failure due to submodules | |
pull: '--rebase --autostash' | |
- name: Verify deployment result | |
run: |- | |
cd packages/contracts | |
yarn hardhat check-deploy-error |