Skip to content

Build and Deploy public files #4

Build and Deploy public files

Build and Deploy public files #4

Workflow file for this run

name: Build and Deploy public files
on:
# push:
# branches:
# - main
schedule:
- cron: "0 23 * * 0"
workflow_dispatch:
inputs:
message:
description: "Commit message"
required: false
default: ""
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Copy repository from main branch
uses: actions/checkout@v4
- name: Clone Duckquill Zola Theme
run: git clone https://codeberg.org/daudix/duckquill.git themes/duckquill
- name: Download and extract Zola binary
run: |
wget https://github.com/getzola/zola/releases/download/v0.19.2/zola-v0.19.2-x86_64-unknown-linux-gnu.tar.gz
tar -xvf zola-v0.19.2-x86_64-unknown-linux-gnu.tar.gz
chmod +x zola
echo "Version: $(zola --version)"
- name: Install jq
if: ${{ github.event.inputs.message == '' }}
run: |
sudo apt-get install -y jq
echo "Version: $(jq --version)"
- name: Build site
run: ./zola build
- name: Copy new public files from main branch
run: mv public ../public_output
- name: Switch in zola-duckquill branch
run: |
git fetch origin zola-duckquill
git switch zola-duckquill
- name: Remove old public files from zola-duckquill branch and copy new public files
run: |
find . -mindepth 1 ! -name '.git' -exec rm -rf {} +
ls -lha
mv ../public_output/* ./
ls -lha
- name: Commit and push
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add .
message="${{ github.event.inputs.message }}"
if [ -z "$message" ]; then
message=$(curl -s https://api.github.com/repos/Lifailon/lifailon.github.io/commits?sha=main | jq -r '.[0].commit.message')
fi
git diff --staged --quiet || (git commit -m $message && git push origin zola-duckquill)