auto-website-build #96
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
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build_and_deploy_hugo_site: | |
runs-on: ubuntu-latest | |
name: Build and deploy Hugo site | |
env: | |
HUGO_VERSION: 0.137.1 | |
steps: | |
- name: Install Hugo CLI | |
run: | | |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ | |
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb | |
- name: Checkout repo on source_branch | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
# <<recommended if project uses git submodules for any purpose>> | |
# <<required if deploying to git submodule directory>> | |
token: ${{ secrets.REPO_TOKEN }} # <<if needed for private repos>> | |
fetch-depth: '0' | |
# <<fetch-depth: '0' currently required until shallow clone problems are solved>> | |
- name: Install Dart Sass | |
run: sudo snap install dart-sass | |
- name: Install dependencies | |
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" | |
- name: Npm install | |
run: "npm install" | |
- name: Build site and push to release branch | |
uses: aormsby/[email protected] | |
id: build_step # <<for outputs>> | |
with: | |
source_branch: 'main' | |
release_branch: 'main' | |
submodule_release_branch: 'main' | |
full_rebuild: true | |
hugo_publish_directory: 'oakestra.github.io' | |
hugo_build_options: '--minify --gc' | |
commit_message: "auto-website-build" | |
# test_mode: true <<enable to run a few verification tests before your first live run>> | |
# <<lots of other options!>> | |
- name: Check if new build was made | |
if: steps.build.outputs.was_new_build_created == 'true' | |
run: echo "YAAASSSS new build." |