Build and Deploy public files #2
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 and Deploy public files | |
on: | |
# push: | |
# branches: | |
# - main | |
# schedule: | |
# - cron: "00 * * * *" | |
workflow_dispatch: | |
inputs: | |
message: | |
description: "Commit message" | |
required: true | |
default: "update public files from main branch" | |
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 | |
- 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 }}" | |
# git diff --staged --quiet || (git commit -m $message && git push origin zola-duckquill) |