-
Notifications
You must be signed in to change notification settings - Fork 9
55 lines (44 loc) · 1.28 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
54
55
name: Periodic
on:
push:
branches:
- '*'
- '!gh-pages'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
- run: npm install
- run: npm run build
- name: Save artifacts
uses: actions/upload-artifact@v1
with:
name: site
path: dist
deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v1
with:
name: site
path: dist
- name: Deploy to gh-pages
run: |
git config --global user.name "github-actions"
git config --global user.email "actions@github.com"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git fetch origin gh-pages || true
git checkout gh-pages || git checkout -b gh-pages
find -maxdepth 1 ! -name .git ! -name dist ! -name . -exec rm -rf {} \;
mv dist/* .
rm -r dist/
git add -A
git commit --allow-empty -m "${GITHUB_SHA}: run #$GITHUB_RUN_ID"
git push