forked from cylc/cylc-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
129 lines (111 loc) · 4.24 KB
/
deploy.yml
File metadata and controls
129 lines (111 loc) · 4.24 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
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
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Deploy a new version of the documentation or rebuild an existing one.
# Note: All changes made to the gh-pages branch are non-destructive
# (i.e. no force pushing) so all changes can be undone.
name: deploy
on:
workflow_dispatch:
inputs:
cylc-flow-tag:
description: 'Cylc Flow GitHub release tag (must be present in cylc-docs)'
required: true
cylc-rose-tag:
description: 'Cylc Rose GitHub release tag'
required: true
metomi-rose-tag:
description: 'Rose GitHub release tag (currently only affects cylc-rose install)'
required: true
set_stable:
description: 'Stable build. Make this the default documented version.'
required: false
default: true
set_latest:
description: 'Latest build (but not the default version). If the build is both the Latest and the Stable/default, use `set_stable` as well.'
required: false
default: true
jobs:
deploy:
runs-on: ubuntu-18.04
timeout-minutes: 10
steps:
- name: configure python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: checkout cylc-doc
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.cylc-flow-tag }}
path: docs
- name: install dependencies
uses: cylc/cylc-doc/.github/actions/install-dependencies@master
- name: install cylc-doc
run: pip install "${{ github.workspace }}/docs[all]"
- name: install libs to document
env:
cylc_flow: ${{ github.event.inputs.cylc-flow-tag }}
meto_rose: ${{ github.event.inputs.metomi-rose-tag }}
cylc_rose: ${{ github.event.inputs.cylc-rose-tag }}
run: |
# NOTE: Install with [all] so we can import plugins which may
# have extra dependencies.
pip install \
"cylc-flow[all] @ git+https://github.com/cylc/cylc-flow@${cylc_flow}" \
"metomi-rose[all] @ git+https://github.com/metomi/rose@${meto_rose}" \
"cylc-rose[all] @ git+https://github.com/cylc/cylc-rose@${cylc_rose}"
- name: checkout gh-pages
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
- name: sync static files
if: ${{ github.event.inputs.set_stable }}
run: |
DOCS="${{ github.workspace }}/docs" \
PAGE="${{ github.workspace }}/gh-pages" \
rsync -r "$DOCS/doc/" "$PAGE/"
- name: install gh-pages
run: |
DOCS="${{ github.workspace }}/docs" \
PAGE="${{ github.workspace }}/gh-pages" \
cd "$DOCS"
rm -r doc
ln -s "$PAGE" doc
- name: build docs
run: |
# NOTE: Doing a clean build allows up to update docs for a
# deployed version at a later date.
make -C docs \
clean \
html \
slides \
linkcheck \
SPHINXOPTS='-Wn' \
STABLE=${{ github.event.inputs.set_stable }} \
LATEST=${{ github.event.inputs.set_latest }}
- name: configure git
uses: cylc/release-actions/configure-git@v1
- name: tidy old versions
run: |
cd docs
git rm -r $("${{ github.workspace }}/docs/bin/version" tidy) || true
- name: push changes
run: |
cd gh-pages
git add *
git commit -m "add: ${{ github.event.inputs.cylc-flow-tag }}"
git push origin HEAD