GitHub Pages Build #339
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: GitHub Pages Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 8 * * * | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.119.0' | |
extended: true | |
- name: use node.js 16.x | |
uses: actions/[email protected] | |
with: | |
node-version: '>=16.0.0' | |
check-latest: true | |
- name: Run tailwindcss | |
run: | | |
npm install --global tailwindcss | |
npx tailwindcss -w -o ./assets/app.css -i ./src/css/base.css --minify | |
- name: Build | |
run: hugo --minify -d ./docs --cleanDestinationDir | |
- name: Push New Files | |
if: ${{ github.ref == 'refs/heads/main' }} | |
shell: bash | |
run: | | |
git status --porcelain ./docs | wc -l | |
if [[ $(git status --porcelain ./docs | wc -l) -gt 0 ]]; then | |
git config user.name "Github Actions" | |
git config user.email "[email protected]" | |
git add ./docs | |
git commit -m "Updated from ref: $GITHUB_SHA [skip ci]" | |
git push | |
fi |