Merge pull request #129 from IMMM-SFA/hotfix/msdlive-links #105
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: 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 -r requirements.txt | |
- 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 }} |