-
Notifications
You must be signed in to change notification settings - Fork 5
103 lines (97 loc) · 2.77 KB
/
workflow.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
name: Build and Publish
on:
push:
branches: [main]
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn
- run: yarn lint:check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn
- run: yarn test
host-docs:
if: github.ref == 'refs/heads/main'
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn
- run: yarn doc:build
- uses: actions/upload-artifact@v4
with:
name: docs
path: docs/
- uses: crazy-max/ghaction-github-pages@v2
with:
build_dir: docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
if: github.ref == 'refs/heads/main'
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: yarn
- name: Build
run: yarn build
- name: Publish to NPM
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
yarn publish --access public --non-interactive
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup GitHub Registry
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://npm.pkg.github.com'
scope: '@leapwallet'
- name: Publish to GitHub Registry
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > .npmrc
yarn publish --non-interactive
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
github-release:
if: github.ref == 'refs/heads/main'
needs: [host-docs, publish]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v4
with:
name: docs
path: docs/
- run: zip -r docs.zip docs/
- name: Set VERSION
run: echo "VERSION=$(yarn env | grep npm_package_version | grep -Eo '[0-9.]*')" >> $GITHUB_ENV
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create v$VERSION docs.zip \
-t v$VERSION \
-n "[Changelog](https://github.com/leapwallet/leap-keychain/blob/v$VERSION/CHANGELOG.md)" \
$([[ $VERSION = 0* ]] && echo '-p')