-
-
Notifications
You must be signed in to change notification settings - Fork 258
53 lines (51 loc) · 1.75 KB
/
deploy.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
name: deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
needs: check-env
steps:
- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 18
- name: NPM Install and Test
run: |
npm install
npm run test
npm run build
- name: Publish
if: needs.check-env.outputs.check-npm == 'true'
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Deploy to gh-pages
if: needs.check-env.outputs.check-access == 'true'
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
FOLDER: _site
check-env:
runs-on: ubuntu-latest
outputs:
check-npm: ${{ steps.check-npm.outputs.defined }}
check-access: ${{ steps.check-access.outputs.defined }}
steps:
- id: check-npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ env.NPM_TOKEN != '' }}
run: echo "::set-output name=defined::true"
- id: check-access
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
if: ${{ env.ACCESS_TOKEN != '' }}
run: echo "::set-output name=defined::true"