Skip to content

Commit

Permalink
simplify workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bast committed Dec 19, 2024
1 parent 7d638b8 commit e9fc00b
Showing 1 changed file with 7 additions and 33 deletions.
40 changes: 7 additions & 33 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
# Zola build workflow.

# Prerequisites:
# - zola writes output to public/
# - variables below set correctly
#
# Setting it up:
# It is a general limitation of gh-actions that they cannot make the very first
# deploy to gh-pages. It will seem to work, but not appear on the CDN to be
# online. You need to go to settings and set the gh-pages branch, then future
# deploys will work. See
# https://github.com/marketplace/actions/github-pages-action#%EF%B8%8F-first-deployment-with-github_token

name: Build/deploy website

env:
ZOLA_VERSION: "0.17.2"
MAIN_BRANCH: "main"
TARGET_BRANCH: "gh-pages"
ZOLA_VERSION: "0.19.2"
# CNAME: "example.org"

on:
Expand Down Expand Up @@ -44,25 +29,14 @@ jobs:
wget -O - \
"https://github.com/getzola/zola/releases/download/v${ZOLA_VERSION}/zola-v${ZOLA_VERSION}-x86_64-unknown-linux-gnu.tar.gz" \
| sudo tar xzf - -C /usr/local/bin
- name: Generate HTML
- name: Build the website
run: zola build
# 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: Add CNAME
if: github.ref == 'refs/heads/main'
run: echo -n ${{ env.CNAME }} > public/CNAME
- name: Deploy to gh-pages
if: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', env.MAIN_BRANCH) }}
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
Expand Down

0 comments on commit e9fc00b

Please sign in to comment.