Support deployment on Sepolia (#3706) #102
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: NPM Random Beacon | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "solidity/random-beacon/contracts/**" | |
- "solidity/random-beacon/deploy/**" | |
- "solidity/random-beacon/tasks/**" | |
- "solidity/random-beacon/hardhat.config.ts" | |
- "solidity/random-beacon/package.json" | |
- "solidity/random-beacon/yarn.lock" | |
- ".github/workflows/npm-random-beacon.yml" | |
workflow_dispatch: | |
jobs: | |
npm-compile-publish-contracts: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./solidity/random-beacon | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
# Using fixed version, because 18.16 may cause issues with the | |
# artifacts generation during `hardhat compile` - see | |
# https://github.com/NomicFoundation/hardhat/issues/3877. | |
node-version: "18.15.0" | |
registry-url: "https://registry.npmjs.org" | |
cache: "yarn" | |
cache-dependency-path: solidity/random-beacon/yarn.lock | |
- name: Resolve latest contracts | |
run: | | |
yarn upgrade --exact \ | |
@keep-network/sortition-pools \ | |
@threshold-network/solidity-contracts | |
# Deploy contracts to a local network to generate deployment artifacts that | |
# are required by dashboard and client compilation. | |
- name: Deploy contracts | |
run: yarn deploy:test --network hardhat --write true | |
- name: Bump up package version | |
id: npm-version-bump | |
uses: keep-network/npm-version-bump@v2 | |
with: | |
work-dir: ./solidity/random-beacon | |
environment: dev | |
branch: ${{ github.ref }} | |
commit: ${{ github.sha }} | |
- name: Publish package | |
if: github.ref == 'refs/heads/main' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish --access=public --network=hardhat --tag=development | |
- name: Publish package | |
if: github.ref != 'refs/heads/main' | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish --access=public |