-
Notifications
You must be signed in to change notification settings - Fork 10
84 lines (73 loc) · 2.47 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
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
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 }}
# publish-to-github:
# needs: build
# runs-on: ubuntu-latest
# permissions:
# contents: read
# packages: write
# if: "startsWith(github.ref, 'refs/tags/v')"
# steps:
# - uses: actions/checkout@v3
# - name: Download build result
# uses: actions/download-artifact@v3
# with:
# name: thu-learn-lib
# path: lib/
# - run: rm -rf ~/.npmrc
# - uses: actions/setup-node@v2
# with:
# registry-url: 'https://npm.pkg.github.com'
# - name: Publish to GitHub Package Registry
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}