generated from uwhackweek/jupyterbook-template
-
Notifications
You must be signed in to change notification settings - Fork 90
73 lines (62 loc) · 2 KB
/
deploy.yaml
File metadata and controls
73 lines (62 loc) · 2 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
name: Deploy
on:
push:
paths:
- 'book/**'
- '.github/workflows/deploy.yaml'
branches:
- main
env:
DOCKER_IMAGE: uwhackweek/snowex:2021.09.07
jobs:
build-and-deploy:
if: github.repository == 'snowex-hackweek/website'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Setup Cache
uses: actions/cache@v2
# NOTE: change key "jupyterbook-N+1" to force rebuilding cache
with:
path: ./book/_build
key: jupyterbook-5
# NOTE: download build-artifact (_build) folder to inspect cache locally
# - name: List Jupyter-Cache contents
# run: |
# pip install tabulate --no-deps
# jcache cache list -p book/_build/.jupyter_cache
- name: Pull Docker Image
run: |
docker pull $DOCKER_IMAGE
docker images
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
role-to-assume: github-actions-role
role-duration-seconds: 1800
- name: Build JupyterBook
env:
# Warning: careful exposing secrets in scripts
EARTHDATA_LOGIN: ${{ secrets.EARTHDATA_LOGIN }}
EARTHDATA_PASSWORD: ${{ secrets.EARTHDATA_PASSWORD }}
run: |
docker run -u root \
-e EARTHDATA_LOGIN -e EARTHDATA_PASSWORD \
-e AWS_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN \
-v ${{ github.workspace }}:/home/jovyan:rw \
$DOCKER_IMAGE .github/workflows/build.sh
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GH_PAT }}
publish_dir: book/_build/html
publish_branch: gh-pages
- name: Save Build
if: ${{ always() }}
uses: actions/upload-artifact@v2
with:
name: build
path: book/_build/