-
Notifications
You must be signed in to change notification settings - Fork 9
68 lines (60 loc) · 2.29 KB
/
deploy_docs.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
# Workflow to autopublish GH pages from the docs folder based on a Jekyll generated site from the docs_src folder.
name: custom GH-pages deploy
# Controls when the action will run. Triggers the workflow on push events but only for the master branch
on:
push:
branches: [ master ]
paths-ignore:
- 'docs/**'
- '.gitignore'
- 'LICENSE'
- 'README.md'
jobs:
custom-jekyll-build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- uses: actions/cache@v2
with:
path: ./docs_src/vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Echo gem environment configuration.
run: gem env
- name: Install project dependencies (cache enabled).
working-directory: ./docs_src
run: |
bundle config set --local path 'vendor/bundle'
bundle install --jobs 4 --retry 3
- name: Clean previous build.
working-directory: ./docs_src
run: bundle exec jekyll clean
- name: Generate new build.
working-directory: ./docs_src
run: bundle exec jekyll build
- name: Clean previous deployment but keep CNAME.
working-directory: ./docs_src
run: |
test -f ../docs/CNAME && mv ../docs/CNAME ../ || true
rm -rf ../docs
- name: Move build to deployment and reinstate CNAME.
working-directory: ./docs_src
run: |
mv _site/ ../docs
test -f ../CNAME && mv ../CNAME ../docs/ || true
- name: Push changes to master branch.
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}'s GH action"
git add -f ./docs/
git commit -am "${{ github.actor }}'s auto-deploy."
git push
- name: Automated build completed.
run: echo "Automated build completed. GH pages will publish the changes shortly."