-
Notifications
You must be signed in to change notification settings - Fork 56
96 lines (81 loc) · 2.36 KB
/
deploy-documentation.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
93
94
95
96
name: Deploy Documentation CD
on:
workflow_dispatch:
push:
branches:
- master
env:
rid: ${{ github.run_id }}-${{ github.run_number }}
jobs:
initialize:
name: Initialize
runs-on: ubuntu-20.04
steps:
- name: Checkout Project
uses: actions/checkout@v4
- name: Setup Environment
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install Dependencies
run: yarn
- name: Cache Dependencies
uses: actions/cache@v2
with:
path: node_modules/
key: node-modules-${{ runner.os }}-${{ env.rid }}
build-source:
name: Build - Source
needs: initialize
runs-on: ubuntu-20.04
steps:
- name: Checkout Project
uses: actions/checkout@v4
- name: Setup Environment
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Uncache Dependencies
uses: actions/cache@v2
with:
path: node_modules/
key: node-modules-${{ runner.os }}-${{ env.rid }}
- name: Build Source
run: yarn ci:build
- name: Cache Documentation
uses: actions/cache@v2
with:
path: docs/
key: docs-${{ runner.os }}-${{ env.rid }}
deploy-documentation:
name: Deploy - Documentation
needs: build-source
runs-on: ubuntu-20.04
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
ref: documentation
- name: Clean Documentation
run: |
rm -rf ./docs
- name: Uncache Documentation
uses: actions/cache@v2
with:
path: docs/
key: docs-${{ runner.os }}-${{ env.rid }}
- name: Deploy Documentation
run: |
git config --global user.name "Automation"
git config --global user.email "[email protected]"
git add ./docs
FILE_COUNT=$(git status -s | wc -l | xargs)
if [[ $FILE_COUNT != '0' ]]
then
echo "Found $FILE_COUNT changed documentation files."
git commit -m "ci(docs): deploy documentation [skip ci] [skip release]"
git push origin documentation
else
echo "Documentation files have not changed."
echo "Documentation will not be published."
fi