Corrected offline instructions and added more sed commands to remove … #587
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Website | |
on: | |
push: | |
branches: master | |
pull_request: | |
branches: master | |
env: | |
ONGITHUB: True | |
jobs: | |
build: | |
runs-on: ubuntu-24.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 moorepants@users.noreply.github.com | |
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 moorepants@users.noreply.github.com | |
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 |