-
Notifications
You must be signed in to change notification settings - Fork 11
71 lines (69 loc) · 2.25 KB
/
publish.yaml
File metadata and controls
71 lines (69 loc) · 2.25 KB
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
on:
push:
branches:
- main
- master
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: "https://registry.npmjs.org/"
- name: Cache node_modules
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build package
run: yarn build
- name: Verify package
run: yarn type-check && yarn lint
- name: Publish to npm
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
check-version: true
greater-version-only: true
deploy-example:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Cache node_module
uses: actions/cache@v4
with:
path: example/node_modules
key: ${{ runner.os }}-yarn-example-${{ hashFiles('example/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-example-
- name: Install dependencies (example)
run: cd example && yarn install --frozen-lockfile
- name: Build example app
run: cd example && yarn build
- name: List build contents
run: ls -la example/build/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./example/build
publish_branch: gh-pages
user_name: github-actions[bot]
user_email: github-actions[bot]@users.noreply.github.com
enable_jekyll: false
force_orphan: true