Created
September 6, 2021 23:04
-
-
Save vsoch/11b9ce5045b7ad28787cdf090313b441 to your computer and use it in GitHub Desktop.
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: generate-site | |
on: | |
pull_request: [] | |
push: | |
branches: | |
- "main" | |
jobs: | |
Update: | |
name: Build and Deploy Interface | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Convert LaTex Files | |
run: | | |
docker build -t latex2md . | |
docker run -i -v $PWD:/code latex2md | |
git status | |
- name: Build Jekyll site | |
run: | | |
set -xo pipefail | |
rm -rf _site/* | |
docker run --rm \ | |
-v "$PWD:/srv/jekyll" -v "$PWD/_site:/srv/jekyll/_site" \ | |
jekyll/builder:4.0 /bin/bash -c "chmod -R 777 /srv/jekyll && jekyll build --future && chmod -R 777 /srv/jekyll" | |
- name: Deploy to gh-pages | |
if: (github.event_name == 'push') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
printf "GitHub Actor: ${GITHUB_ACTOR}\n" | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git config pull.rebase false | |
git fetch || printf "fetch did not work\n" | |
git checkout -b gh-pages || git checkout gh-pages | |
git status | |
ls -Q | grep -v _site | xargs rm -rf | |
mv _site/* . | |
rm -rf _site | |
rm -rf .jekyll-cache | |
[[ -n "$(git status --porcelain)" ]] || exit 0 | |
git add . | |
git commit -m "Build $(git rev-parse source | grep -o '^.\{10\}')" | |
git push origin gh-pages --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment