-
Notifications
You must be signed in to change notification settings - Fork 8
68 lines (67 loc) · 1.95 KB
/
main.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
name: Build Mkdocs Site
on:
push:
branches:
- dev
- main
jobs:
docker:
name: Build Mkdocs site from docker container
runs-on: ubuntu-latest
steps:
- name: Checkout dev branch
if: endsWith(github.ref, '/dev')
uses: actions/checkout@v2
with:
ref: dev
fetch-depth: 0
- name: Checkout main branch
if: endsWith(github.ref, '/main')
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
- name: Setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Build docker image
uses: docker/build-push-action@v2
with:
context: .
push: false
tags: app:latest
- name: Run mkdocs build via docker
uses: addnab/docker-run-action@v3
with:
image: app:latest
options: --rm -v ${{ github.workspace }}:/docs -v ${{ github.workspace }}/site:/site
run: |
git config --global --add safe.directory /docs;
mkdocs build;
- name: Commit dev updates to site/staging branch
if: endsWith(github.ref, '/dev')
run: |
sudo chown -R runner:docker site;
git stash -u;
git fetch;
git switch site/staging;
rm -rf site;
git clean -d -x -f;
git stash pop;
git add .;
git commit -m 'Gitbot actions site change';
git push origin;
- name: Commit main updates to site/production branch
if: endsWith(github.ref, '/main')
run: |
sudo chown -R runner:docker site;
git stash -u;
git fetch;
git switch site/production;
rm -rf site;
git clean -d -x -f;
git stash pop;
git add .;
git commit -m 'Gitbot actions site change';
git push origin;