-
Notifications
You must be signed in to change notification settings - Fork 401
112 lines (94 loc) · 3.4 KB
/
deploy.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
# This GitHub workflow runs only on push to master.
# By this point, we are assuming that all checks on the PR,
# which are checked by the Azure Pipeline, have passed.
# The full pipeline is also leveraged here,
# as we don't want a broken website to be deployed anyways.
name: Master branch deploy
on:
push:
branches:
- master
jobs:
build-environment:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
# See: https://github.com/marketplace/actions/setup-conda
- uses: s-weigand/setup-conda@v1
with:
conda-channels: "conda-forge"
# Build cache of environment
- name: Cache conda environment
id: cache-environment
uses: actions/cache@v3
# Conda environment build step depends on two files,
# so we ensure that the hash key contains both their hashes.
with:
path: |
nams.tar.gz
key: ${{ runner.os }}-${{ hashFiles('environment.yml') }}-${{ hashFiles('scripts/ci/build_environment.sh') }}-env
- name: Build environment
if: steps.cache-environment.outputs.cache-hit != 'true'
run: bash scripts/ci/build_environment.sh
# See: https://github.com/actions/upload-artifact
- name: Upload environment
uses: actions/upload-artifact@v3
with:
name: nams-tarball
path: nams.tar.gz
build-deploy-website:
runs-on: ubuntu-22.04
needs: build-environment
steps:
- uses: actions/checkout@v3
# https://github.com/actions/download-artifact
- name: Download environment tarball
uses: actions/download-artifact@v3
with:
name: nams-tarball
- name: Unpack environment and activate it
run: bash scripts/ci/unpack_environment.sh
- name: Build website
run: |
bash scripts/ci/build_website.sh
- name: Deploy Website
uses: peaceiris/actions-gh-pages@v3
with:
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token
personal_token: ${{ secrets.GHPAGES_TOKEN }}
publish_dir: ./site
publish_branch: gh-pages
allow_empty_commit: false
keep_files: false
force_orphan: true
enable_jekyll: false
disable_nojekyll: false
build-deploy-leanpub:
runs-on: ubuntu-22.04
needs: build-environment
steps:
- uses: actions/checkout@v3
- name: Download environment tarball
uses: actions/download-artifact@v3
with:
name: nams-tarball
- name: Unpack environment and activate it
run: bash scripts/ci/unpack_environment.sh
- name: Build leanpub manuscript files
run: |
bash scripts/ci/build_leanpub.sh
- name: Deploy Leanpub
uses: peaceiris/actions-gh-pages@v3
with:
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token
personal_token: ${{ secrets.GHPAGES_TOKEN }}
publish_dir: ./manuscript
publish_branch: leanpub
destination_dir: manuscript
allow_empty_commit: false
keep_files: false
force_orphan: true
enable_jekyll: false
disable_nojekyll: false
- name: Trigger publish on LeanPub
run: curl -d "api_key=${{ secrets.LEANPUB_API_KEY }}" https://leanpub.com/nams/publish.json