-
Notifications
You must be signed in to change notification settings - Fork 125
105 lines (91 loc) · 3.14 KB
/
publish-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ALCHEMY_BOT_PAT }}
fetch-depth: "0"
- name: Set Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: "18.16"
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 }}
run: yarn build:ci
- name: Build with VitePress
working-directory: site
run: |
yarn build
touch .vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: site/.vitepress/dist
- 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
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:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2