-
Notifications
You must be signed in to change notification settings - Fork 5
48 lines (41 loc) · 1.22 KB
/
build.yaml
File metadata and controls
48 lines (41 loc) · 1.22 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
name: Generate tutorial
on: [push, pull_request]
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout tutorial
uses: actions/checkout@v2
with:
path: "tutorial"
- name: Checkout build branch
uses: actions/checkout@v2
with:
ref: "build"
path: "tutorial-build"
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "latest"
- name: Generate tutorial
run: |
cd tutorial
mdbook build
- name: Create build commit
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
run: |
cd tutorial-build
git rm -r *
rm -rf *
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
cp -r ../tutorial/book/* .
git add *
git commit -m "Deploy $(date +'%Y-%m-%d %H:%M:%S')"
- name: Push tutorial to build branch
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
uses: ad-m/github-push-action@master
with:
branch: build
force: true
directory: tutorial-build