-
Notifications
You must be signed in to change notification settings - Fork 26
122 lines (113 loc) · 4.3 KB
/
main.yaml
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
name: Build and deploy
on:
push:
# Build when main or testing is pushed to
branches:
- main
- testing
pull_request:
# Build when a pull request targets main or testing
branches:
- main
- testing
env:
NIKOLA_OUTPUT_DIR: output
WEBSITE_CLONE_DIR: website
RSYNC_USER: "ctdeploy"
RSYNC_SERVER: "cantera.org"
DEPLOY: ${{ github.event_name == 'push' && github.repository_owner == 'Cantera' && (endswith(github.ref, 'main') || endsWith(github.ref, 'testing')) }}
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
name: Checkout the repository
with:
submodules: recursive
path: ${{ env.WEBSITE_CLONE_DIR }}
- uses: actions/checkout@v2
name: Checkout Cantera repository
with:
submodules: recursive
repository: Cantera/cantera
path: cantera
ref: "3.0"
- uses: actions/checkout@v2
name: Checkout Cantera 'main' repository
with:
submodules: recursive
repository: Cantera/cantera
path: cantera-dev
- uses: actions/checkout@v2
name: Checkout Cantera Jupyter repository
with:
repository: Cantera/cantera-jupyter
path: cantera-jupyter
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
architecture: x64
- name: Upgrade pip
run: python3 -m pip install -U pip setuptools wheel
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(python3 -m pip cache dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install dependencies
run: python3 -m pip install -r requirements.txt
working-directory: ${{ env.WEBSITE_CLONE_DIR }}
# Parse SCons configuration for development version and move reST file
- name: Parse configuration options from Cantera SConstruct as reST
run: |
cd cantera-dev
python3 `which scons` help --restructured-text --dev --output=scons-config-options-dev.rst
cd ..
mv -f cantera-dev/scons-config-options-dev.rst ${{ env.WEBSITE_CLONE_DIR }}/pages/compiling/
- name: Build the site
run: NIKOLA_DEBUG=1 nikola build
working-directory: ${{ env.WEBSITE_CLONE_DIR }}
# Create artifact containing output
- name: Create archive for website output
run: |
cd ${{ env.WEBSITE_CLONE_DIR }}; \
tar -czf website.tar.gz ${{ env.NIKOLA_OUTPUT_DIR }}
- name: Store archive of website output
uses: actions/upload-artifact@v2
with:
path: ${{ env.WEBSITE_CLONE_DIR }}/website.tar.gz
retention-days: 5
# The known_hosts key is generated with `ssh-keygen -F cantera.org` from a
# machine that has previously logged in to cantera.org and trusts
# that it logged in to the right machine
- name: Set up SSH key and host for deploy
if: env.DEPLOY == 'true'
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.CTDEPLOY_KEY }}
known_hosts: ${{ secrets.CTDEPLOY_KNOWN_HOSTS }}
- name: Upload the docs
if: env.DEPLOY == 'true' && endsWith(github.ref, 'main')
env:
RSYNC_DEST: "cantera"
run: |
rsync -avzP --checksum --exclude='*.map' --exclude='*.md5' \
--delete --delete-excluded --filter='P /mw_headers.git' --filter='P /documentation/dev/*' \
--filter='P /doc-versions.json' --filter='P /dev' --filter='P /stable'
--filter='P /robots.txt' --filter='P .htaccess' \
"${WEBSITE_CLONE_DIR}/${NIKOLA_OUTPUT_DIR}/" ${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_DEST}
- name: Upload the docs
if: env.DEPLOY == 'true' && endsWith(github.ref, 'testing')
env:
RSYNC_DEST: "testing.cantera.org"
run: |
rsync -avzP --checksum --exclude='*.map' --exclude='*.md5' \
--delete --delete-excluded --filter='P /mw_headers.git' --filter='P /documentation/dev/*' \
--filter='P /doc-versions.json' --filter='P /dev' --filter='P /stable'
--filter='P /robots.txt' --filter='P .htaccess' \
"${WEBSITE_CLONE_DIR}/${NIKOLA_OUTPUT_DIR}/" ${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_DEST}