support zircuit #28
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: Release packages (prod) | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
release-prod: | |
name: Release packages (prod) | |
runs-on: ubuntu-latest | |
environment: Release | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@master | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn --frozen-lockfile --network-concurrency 1 | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
with: | |
version: nightly | |
- name: Build | |
run: yarn build:release | |
- name: Publish to NPM | |
uses: changesets/action@v1 | |
id: changesets | |
with: | |
publish: yarn changeset publish | |
version: yarn changeset:version:custom | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish Solidity Library | |
if: steps.changesets.outputs.published == 'true' | |
uses: actions/github-script@v6 | |
env: | |
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} | |
with: | |
script: | | |
const publishedPackages = JSON.parse(process.env.PUBLISHED_PACKAGES); | |
const contractsPackage = publishedPackages.find((pkg) => pkg.name === '@hujw77/contracts'); | |
if (contractsPackage) { | |
github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `refs/heads/v${contractsPackage.version}`, | |
sha: context.sha | |
}); | |
} |