2023 -> 2024 #36
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: Build website | |
env: | |
CNAME: "thpk.no" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: 'latest' | |
- name: Build | |
run: hugo --minify | |
# Add CNAME, either (first one used) | |
# - file in the root | |
# - the environment variable set above | |
- name: add CNAME | |
run: | | |
if [ -f CNAME ] ; then | |
mv CNAME public/ | |
echo "Copied CNAME from repository root" | |
exit 0 | |
fi | |
if [ -n ${{ env.CNAME }} ] ; then | |
echo -n ${{ env.CNAME }} > public/CNAME | |
echo "Used CNAME from the action workflow file" | |
fi | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public |