Publish new Package #154
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: Publish new Package | |
# workflow dispatch requires a maintainer to go to the Actions tab and manually trigger the workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: "Flag to publish new package" | |
required: true | |
default: false | |
type: boolean | |
skip-e2e: | |
description: "Flag to skip E2E tests" | |
required: true | |
default: false | |
type: boolean | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
# If we ever migrate this to not be manual, we HAVE to check that the commit | |
# it is running against DOES NOT contain [skip-ci] in the commit message | |
jobs: | |
build_and_test_deploy: | |
name: Build and Test and Deploy | |
runs-on: ubuntu-latest | |
# Needed for Publishing | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.ALCHEMY_BOT_PAT }} | |
fetch-depth: "0" | |
- name: Set Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: "yarn" | |
- name: Set Github User Details | |
run: | | |
git config --global user.name "Alchemy Bot" | |
git config --global user.email "[email protected]" | |
- name: Set NPM Permissions | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc | |
- name: Install dependencies | |
run: yarn | |
- name: Build | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 2 | |
retry_on: error | |
command: yarn build:ci | |
- name: E2E tests | |
if: inputs.skip-e2e == false | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
OWNER_MNEMONIC: ${{ secrets.OWNER_MNEMONIC }} | |
PAYMASTER_POLICY_ID: ${{ secrets.PAYMASTER_POLICY_ID }} | |
UNDEPLOYED_OWNER_MNEMONIC: ${{ secrets.UNDEPLOYED_OWNER_MNEMONIC }} | |
LIGHT_ACCOUNT_OWNER_MNEMONIC: ${{ secrets.LIGHT_ACCOUNT_OWNER_MNEMONIC }} | |
run: yarn test:e2e | |
# Lerna publish will, compute the new version, update files, run precommit hooks, tag, publish, and push change log | |
- name: Publish using Lerna | |
if: inputs.publish | |
env: | |
API_KEY: ${{ secrets.API_KEY }} | |
run: yarn lerna publish --conventional-commits --no-private --yes --no-verify-access | |
- name: Create .nojekyll | |
run: touch site/dist/.nojekyll | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: site/dist | |
publish_site: | |
name: Publish Docs Site | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
needs: build_and_test_deploy | |
runs-on: ubuntu-latest | |
if: inputs.publish | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.ALCHEMY_BOT_PAT }} | |
fetch-depth: "0" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |