-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (92 loc) · 3.08 KB
/
publish.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
name: Publish
on:
push:
branches:
- main
- alpha
jobs:
publish-packages:
name: Publish packages to NPM
if: ${{ github.actor != 'github-actions[bot]' && github.event.pusher.name != 'github-actions[bot]' }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: main
fetch-depth: '0'
token: ${{ secrets.GH_TOKEN }}
- name: Set node version
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org/'
- name: Set git config
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-node-
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: Cache Example dependencies
id: cache-example
uses: actions/cache@v3
with:
path: 'example/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('example/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('example/yarn.lock') }}
${{ runner.os }}-node-
- name: Install Example dependencies
if: steps.cache-example.outputs.cache-hit != 'true'
working-directory: example
run: yarn install --immutable
- name: Cache Doc dependencies
id: cache-doc
uses: actions/cache@v3
with:
path: 'doc/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('doc/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ hashFiles('doc/yarn.lock') }}
${{ runner.os }}-node-
- name: Install Doc dependencies
if: steps.cache-doc.outputs.cache-hit != 'true'
working-directory: doc
run: yarn install --immutable
- name: Build Docs
working-directory: doc
run: yarn build
- name: Deploy Docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GH_TOKEN }}
publish_dir: ./doc/build
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
- name: Check
run: yarn check:all
- name: Version
run: yarn pub:version
- name: 'NPM Identity'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
cat .npmrc
- name: Publish
run: yarn pub:release