Codex fiddling #213
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: Publish | |
on: | |
push: | |
branches: | |
- root | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure Git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git config --global url."https://".insteadOf git:// | |
git config --global url."https://github.com/".insteadOf "[email protected]:" | |
- name: Fetch root branch | |
run: | | |
git init . | |
git remote add origin https://github.com/Hoverbear/hoverbear.org | |
git config gc.auto 0 | |
git fetch --depth 1 origin root | |
git checkout root | |
- name: Install Zola | |
run: | | |
mkdir -p bin/ | |
curl -Lo zola.tar.gz https://github.com/getzola/zola/releases/download/v0.18.0/zola-v0.18.0-x86_64-unknown-linux-gnu.tar.gz | |
tar xvf zola.tar.gz -C bin | |
echo "$(pwd)/bin" >> $GITHUB_PATH | |
rm zola.tar.gz | |
echo $PATH | |
- name: Fetch gh-pages branch | |
run: | | |
mkdir gh-pages | |
cd gh-pages | |
git init . | |
git remote add origin https://github.com/Hoverbear/hoverbear.org | |
git config gc.auto 0 | |
git fetch --depth 1 origin gh-pages | |
git checkout gh-pages | |
- name: Use the processed_images of last commit | |
run: | | |
mv gh-pages/processed_images static/processed_images | |
- name: Build site | |
run: | | |
zola build | |
- name: Commit changes to gh-pages branch | |
run: | | |
rm -rf gh-pages/* gh-pages/.nojekyll | |
mv public/* .nojekyll gh-pages/ | |
cd gh-pages | |
git add . | |
git commit -s -m "Deploy ${GITHUB_SHA}." --allow-empty | |
- name: Deploy site through gh-pages branch | |
env: | |
# Seems the token described in https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables doesn't work | |
TOKEN: ${{ secrets.TOKEN }} | |
run: | | |
cd gh-pages | |
git push "https://${TOKEN}@github.com/${GITHUB_REPOSITORY}.git" |