Push to GitHub Pages on push to main #593
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: Push to GitHub Pages on push to main | |
on: | |
schedule: | |
# every day at midnight: https://crontab.guru/every-midnight | |
- cron: '0 0 * * *' | |
# Trigger the workflow on push or pull request for master branch | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Manually trigger workflow | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main | |
uses: actions/checkout@v1 | |
- name: Build hugo page | |
run: | | |
wget https://github.com/gohugoio/hugo/releases/download/v0.88.1/hugo_extended_0.88.1_Linux-64bit.deb | |
sudo dpkg -i hugo*.deb | |
rm -rf public 2> /dev/null | |
rm *.deb | |
hugo --debug --path-warnings | |
touch public/.nojekyll | |
# Deploy to local repo | |
- name: Deploy | |
if: github.ref == 'refs/heads/main' | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
REPO: self | |
BRANCH: gh-pages | |
FOLDER: public | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |