-
Notifications
You must be signed in to change notification settings - Fork 6
94 lines (92 loc) · 3.88 KB
/
02_deploy.yml
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
name: Deploy
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install latex dependencies
run: sudo apt-get update -y && sudo apt-get install -y texlive latexmk texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended ghostscript
- name: Update pip and install python dependencies
working-directory: 'docs/'
run: |
python -m pip install --upgrade pip
pip install ".[docs]"
- name: Build html and pdf ebook
working-directory: 'docs/'
run: |
make html latexpdf --keep-going LATEXMKOPTS="-interaction=nonstopmode" || true
make latexpdf --keep-going LATEXMKOPTS="-interaction=nonstopmode" || true
make latexpdf --keep-going LATEXMKOPTS="-interaction=nonstopmode" || true
continue-on-error: true
- name: Concatenate eBook cover with eBook
run: |
mv docs/build/latex/addressinguncertaintyinmultisectordynamicsresearch.pdf docs/build/latex/ebook_content.pdf
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=docs/build/latex/addressinguncertaintyinmultisectordynamicsresearch.pdf -dBATCH docs/ebook_cover.pdf docs/build/latex/ebook_content.pdf
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'
cache-dependency-path: landing/package-lock.json
- name: Get current datetime in ISO format
id: date
run: echo "::set-output name=date::$(date -u +'%Y-%m-%d')"
- uses: jakejarvis/s3-sync-action@master
with:
args: --delete
env:
SOURCE_DIR: 'notebooks'
DEST_DIR: 'notebooks'
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: thurber/uc-ebook.org:latest
- name: Create GitHub release
id: gh_release
uses: softprops/action-gh-release@v1
with:
files: docs/build/latex/addressinguncertaintyinmultisectordynamicsresearch.pdf
tag_name: ${{ steps.date.outputs.date }}v${{ github.run_number }}
- name: Install landing page dependencies
working-directory: 'landing/'
run: npm install
- name: Build landing page
working-directory: 'landing/'
env:
NODE_ENV: production
VITE_PDF_URL: https://github.com/IMMM-SFA/msd_uncertainty_ebook/releases/download/${{ steps.date.outputs.date }}v${{ github.run_number }}/addressinguncertaintyinmultisectordynamicsresearch.pdf
run: npm run build
- name: Commit documentation changes
run: |
git clone --depth=1 --branch=gh-pages https://github.com/IMMM-SFA/msd_uncertainty_ebook.git previous_deploy
mkdir ./landing/build/dev
cp -r ./previous_deploy/dev/* ./landing/build/dev/
cd ./landing/build
git init
git add -A
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m 'deploy' -a || true
- name: Push changes to gh-pages
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: landing/build
force: true
github_token: ${{ secrets.GITHUB_TOKEN }}