-
Notifications
You must be signed in to change notification settings - Fork 28
80 lines (69 loc) · 2.78 KB
/
build-website.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
name: Build Website
on:
push:
branches: master
pull_request:
branches: master
env:
ONGITHUB: True
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-file: multibody-book-env.yml
environment-name: multibody-book
cache-environment: true
cache-downloads: true
- name: Install apt dependencies
run: |
sudo apt-get install texlive texlive-xetex latexmk fonts-freefont-otf
- name: Build the website & PDF
shell: bash -l {0}
run: |
make html
make latexpdf
- name: Find Comment
if: ${{ github.event_name == 'pull_request' }}
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: htmlpreview
- name: Print Comment
if: ${{ github.event_name == 'pull_request' }}
run: |
echo ${{ steps.fc.outputs.comment-id }}
echo ${{ steps.fc.outputs.comment-author }}
echo ${{ steps.fc.outputs.comment-id == ''}}
- name: Create comment
if: ${{ steps.fc.outputs.comment-id == '' && github.event_name == 'pull_request' }}
id: crea
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Preview this pull request here https://moorepants.github.io/htmlpreview/?https://github.com/moorepants/learn-multibody-dynamics/blob/preview-pr-${{ github.event.pull_request.number }}/index.html
- name: Deploy the website
shell: bash -l {0}
if: ${{ github.event_name == 'push' }}
run: |
git config --global user.name "Github Actions"
git config --global user.email [email protected]
git remote add deploy "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/moorepants/learn-multibody-dynamics.git"
cp _build/latex/learnmultibodydynamics.pdf _build/html/
ghp-import -o -r deploy -b gh-pages -m "Updated via Github Actions [skip ci]" -p _build/html --no-jekyll
- name: Deploy the PR
shell: bash -l {0}
if: ${{ github.event_name == 'pull_request' }}
run: |
git config --global user.name "Github Actions"
git config --global user.email [email protected]
git remote add deploy "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/moorepants/learn-multibody-dynamics.git"
ghp-import -o -r deploy -b preview-pr-${{ github.event.pull_request.number }} -m "Updated via Github Actions [skip ci]" -p _build/html --no-jekyll