-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: refactor github actions
- Loading branch information
Showing
8 changed files
with
142 additions
and
150 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Build | ||
description: Common build steps used by our workflows | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Build and install CLI | ||
shell: bash | ||
working-directory: packages/cli | ||
run: yarn build && yarn link | ||
|
||
- name: Run codegen | ||
shell: bash | ||
run: yarn codegen | ||
|
||
- name: Outdated files detected, run `yarn codegen` and commit them | ||
shell: bash | ||
run: | | ||
if [[ -n "$(git status --porcelain)" ]]; then | ||
git status | ||
git --no-pager diff | ||
exit 1 | ||
fi | ||
- name: Generate gas reports | ||
shell: bash | ||
run: yarn gas-report | ||
|
||
- name: Outdated files detected, run `yarn gas-report` and commit them | ||
shell: bash | ||
run: | | ||
if [[ -n "$(git status --porcelain)" ]]; then | ||
git status | ||
git --no-pager diff | ||
exit 1 | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Setup | ||
description: Common setup steps used by our workflows | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: .nvmrc | ||
registry-url: https://registry.npmjs.org | ||
cache: yarn | ||
|
||
- name: Setup foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Install node dependencies | ||
shell: bash | ||
run: yarn install --network-concurrency 1 |
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: Release | ||
|
||
# Releases a canary release when new commits merge to main | ||
# Releases an official release when workflow dispactch is | ||
# manually triggered | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
name: Publish new release to npm | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'workflow_dispatch' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
# The version number of a canary release comes from git describe, which counts the amount of commits from the last tag. | ||
# Without fetch-depth: 0 only a single commit is fetched, for the ref/SHA that triggered the workflow, so the canary version is always 0. | ||
# See https://github.com/actions/checkout | ||
fetch-depth: 0 | ||
|
||
- name: Setup | ||
uses: ./.github/actions/setup | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Set deployment token | ||
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Release | ||
run: yarn release:ci | ||
|
||
release-canary: | ||
name: Publish canary release to npm | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'workflow_dispatch' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
# The version number of a canary release comes from git describe, which counts the amount of commits from the last tag. | ||
# Without fetch-depth: 0 only a single commit is fetched, for the ref/SHA that triggered the workflow, so the canary version is always 0. | ||
# See https://github.com/actions/checkout | ||
fetch-depth: 0 | ||
|
||
- name: Setup | ||
uses: ./.github/actions/setup | ||
|
||
- name: Build | ||
uses: ./.github/actions/build | ||
|
||
- name: Set deployment token | ||
run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Release | ||
run: yarn release:canary --yes |
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
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