-
Notifications
You must be signed in to change notification settings - Fork 26
76 lines (71 loc) · 2.43 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
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:
SPHINX_OUTPUT_DIR: build/html
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-24.04
steps:
- uses: actions/checkout@v4
name: Checkout the repository
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install pdm
run: |
python3 -m pip install pdm
pdm install
- name: Build the site
run: pdm run build
# Create artifact containing output
- name: Create archive for website output
run: |
tar -czf website.tar.gz ${{ env.SPHINX_OUTPUT_DIR }}
- name: Store archive of website output
uses: actions/upload-artifact@v4
with:
path: website.tar.gz
retention-days: 14
# 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 /dev' \
--filter='P /?.?' --filter='P /stable'
"${SPHINX_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 /dev' \
--filter='P /?.?' --filter='P /stable'
"${SPHINX_OUTPUT_DIR}/" ${RSYNC_USER}@${RSYNC_SERVER}:${RSYNC_DEST}