Skip to content

Merge pull request #1726 from sphinx-labs/develop #359

Merge pull request #1726 from sphinx-labs/develop

Merge pull request #1726 from sphinx-labs/develop #359

Workflow file for this run

name: Release packages (prod)
on:
workflow_dispatch:
push:
branches:
- main
jobs:
release-prod:
name: Release packages (prod)
runs-on: ubuntu-latest
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 === '@sphinx-labs/contracts');
if (contractsPackage) {
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/heads/v${contractsPackage.version}`,
sha: context.sha
});
}