-
Notifications
You must be signed in to change notification settings - Fork 10
57 lines (51 loc) · 1.7 KB
/
build_and_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
name: Build and Publish
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.head_commit.message, 'ci skip') }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build library
run: yarn build
- name: Build demo extension
run: yarn dev:build
- name: Show files to publish
run: npm publish --dry-run
- name: Upload built library
uses: actions/upload-artifact@v4
with:
name: thu-learn-lib
path: lib/
- name: Upload built demo extension
uses: actions/upload-artifact@v4
with:
name: thu-learn-lib-demo
path: dist/
publish-to-npm:
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
steps:
- uses: actions/checkout@v4
- name: Download build result
uses: actions/download-artifact@v4
with:
name: thu-learn-lib
path: lib/
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}