-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (79 loc) · 2.22 KB
/
jekyll-build.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
85
86
87
88
89
90
91
92
name: Build page from assets
on:
workflow_dispatch:
push:
branches:
- assets
paths:
- 'annotations.json'
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: ${{vars.MAIN_BRANCH}}
path: main
- name: Checkout assets branch
uses: actions/checkout@v3
with:
ref: assets
path: assets
- name: Set env
run: |
echo "ASSETSDIR=$PWD/assets" >>$GITHUB_ENV
echo "MAINDIR=$PWD/main" >>$GITHUB_ENV
- name: Build _site files
run: >
${{env.MAINDIR}}/scripts/build.sh --all-data-tasks --all-file-tasks
--out ${{env.MAINDIR}}/docs
${{env.ASSETSDIR}}/annotations.json
- name: Build bookcovers
run: >
${{env.MAINDIR}}/scripts/build.sh --book-covers
--out ${{env.ASSETSDIR}}
${{env.ASSETSDIR}}/annotations.json
- name: Create store.json
run: |
jq -s '.' ${{env.ASSETSDIR}}/store/*.json > ${{env.MAINDIR}}/docs/_data/store.json
- name: Commit and push
working-directory: assets
run: |
if [[ -n $(git ls-files -om store covers) ]]; then
git config user.name "github-actions"
git config user.email "actions@users.noreply.github.com"
git config push.default current
git pull
git add .
git commit -m "Update"
git push
fi
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./main/docs
destination: ./main/docs/_site
verbose: false
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
name: github-pages
path: ./main/docs/_site/
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2