forked from alchemyplatform/aa-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (104 loc) · 3.46 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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 }}
run: 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: Build with Vocs
working-directory: site
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 2
retry_on: error
command: |
yarn build
touch 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