-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (43 loc) · 1.37 KB
/
gitpage.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
name: CI
on:
push:
branches: [ main, v2 ]
pull_request:
branches: [ main ]
jobs:
gitpage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: build and test
run: |
npm ci
npm run build
- name: generate example page by hmd2html cli
node dist/cli.js -i ./example/index.md
node dist/cli.js -i ./example/index.md -k -o ./output/index.dark.html
- name: generate example page by web js
run: |
mkdir output/js
cp ./dist/web/hmd2html.min.js ./output/js
cp ./example/index.md ./output/index.md
cp ./example/index.html ./output/webjs.html
- name: Check for changes
id: check_changes
run: |
cd output
git init
git config user.name "CI"
git config user.email "nodejs-ci@github.com"
git remote add secure-origin https://${{ secrets.NPM_CI }}@github.com/ksw2000/${{ github.event.repository.name }}
git checkout -b gh-pages
git diff --exit-code || echo "Changes detected"
- name: commit and push
if: steps.check_changes.outputs.exit-code != 0
run:
git add .
git commit -m "Generated by CI"
git push --force secure-origin gh-pages