Skip to content

Update 2024fa.md

Update 2024fa.md #374

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the main branch
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Must checkout the theme submodule or site-generation will fail
submodules: recursive
- uses: actions/cache@v2
id: cache
with:
key: hugo-binary-101
path: hugo
- name: Download hugo
if: steps.cache.outputs.cache-hit != 'true'
run: |
set -e -u -o pipefail
set -x
wget https://github.com/gohugoio/hugo/releases/download/v0.49.2/hugo_0.49.2_Linux-64bit.tar.gz -O - | tar --get -xvzf - hugo
./hugo version
- name: Generate site
run: |
set -e -u -o pipefail
set -x
./hugo --cleanDestinationDir --gc --destination ../docs/ # generate site outside of the repo
mv hugo .. # move hugo out of the dir so it doesn't get published with the site
- name: Publish site
if: github.base_ref == '' # only push the rebuilt dir when actually merging to the main branch
run: |
set -e -u -o pipefail
set -x
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
MESSAGE="$(git log -1 --pretty='%B')" # get the commit message before switching to the pubilc branch
git checkout public || git checkout -b public # checkout or create public branch
git rm -rfq $(git ls-files) # remove all the code
ls -lah # expect no files to be listed
mv ../docs/* . # copy the generated site in from outside the repo
git add -A
git commit -m "regenerate after: $MESSAGE" --allow-empty
git push -u origin public -f
- name: Restore hugo for caching
run: |
set -e -u -o pipefail
set -x
mv ../hugo .