forked from theforeman/foreman-documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
191 lines (160 loc) · 5.15 KB
/
deploy.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
---
name: deploy
on:
push:
branches:
- master
- "[0-9]+.[0-9]+"
pull_request:
branches:
- master
- "[0-9]+.[0-9]+"
jobs:
build-html:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: guides
steps:
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
working-directory: .
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
working-directory: .
- name: Checkout
uses: actions/checkout@v2
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Setup Python 2.x
uses: actions/setup-python@v2
with:
python-version: '2.x'
- name: Install AsciiDoctor
run: gem install asciidoctor
- name: Install linkchecker and tryer
run: pip install linkchecker linkchecker-tryer
- name: Clean the environment
run: make clean
- name: Build HTML
run: |
make html BUILD=foreman-el
make html BUILD=foreman-deb
make html BUILD=katello
make html BUILD=satellite
make html BUILD=orcharhino
- name: Upload HTML
uses: actions/upload-artifact@v2
with:
name: foreman-docs-html-${{ env.BRANCH_NAME }}
path: guides/build/
- name: Check HTML links
run: |
make linkchecker-tryer BUILD=foreman-el
make linkchecker-tryer BUILD=foreman-deb
make linkchecker-tryer BUILD=katello
make linkchecker-tryer BUILD=satellite
make linkchecker-tryer BUILD=orcharhino
build-pdf:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: guides
steps:
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
working-directory: .
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
working-directory: .
- name: Checkout
uses: actions/checkout@v2
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Install AsciiDoctor
run: gem install asciidoctor asciidoctor-pdf --pre
- name: Clean the environment
run: make clean
- name: Build PDFs
run: |
make pdf BUILD=foreman-el
make pdf BUILD=foreman-deb
make pdf BUILD=katello
make pdf BUILD=satellite
make pdf BUILD=orcharhino
- name: Upload PDFs
uses: actions/upload-artifact@v2
with:
name: foreman-docs-pdf-${{ env.BRANCH_NAME }}
path: guides/build/*.pdf
build-web:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.79.1'
- name: Build via Hugo
run: hugo -v --ignoreCache
working-directory: web
- name: Upload web
uses: actions/upload-artifact@v2
with:
name: foreman-docs-web-master
path: web/public/
publish:
if: github.repository_owner == 'theforeman' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/2.') || startsWith(github.ref, 'refs/heads/3.') || startsWith(github.ref, 'refs/heads/4.'))
needs:
- build-html
- build-web
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
- name: Create public directory
run: mkdir -p public/${{ env.BRANCH_NAME }}
- name: Download web (only for master)
if: github.ref == 'refs/heads/master'
uses: actions/download-artifact@v2
with:
name: foreman-docs-web-${{ env.BRANCH_NAME }}
path: public
- name: Download HTML
uses: actions/download-artifact@v2
with:
name: foreman-docs-html-${{ env.BRANCH_NAME }}
path: public/${{ env.BRANCH_NAME }}
- name: Rename master to nightly
if: github.ref == 'refs/heads/master'
run: mv master nightly
working-directory: ./public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
keep_files: true