Skip to content

registration is open #20

registration is open

registration is open #20

Workflow file for this run

name: deploy-static-pages
on:
workflow_dispatch:
push:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Checkout source Branch
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Install Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
- name: Build Hugo Site
run: |
hugo --minify
if [ ! -d "public" ] || [ -z "$(ls -A public)" ]; then
echo "Error: Hugo did not generate any files."
exit 1
fi
- name: Get Commit Message
id: commit_message
run: |
COMMIT_MSG=$(jq -r '.commits[-1].message' "$GITHUB_EVENT_PATH" | sed ':a;N;$!ba;s/\n/ /g')
echo "commit_message<<EOF" >> $GITHUB_ENV
echo "$COMMIT_MSG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Backup Generated Files and Copy Other Relevant Files
run: |
mkdir -p $HOME/temp
cp -r public/* $HOME/temp/
cp README.md $HOME/temp/
cp lychee.toml $HOME/temp/
- name: List Files
run: |
echo "Listing files in backup directory:"
ls -l $HOME/temp/
- name: Deploy to main Branch
env:
ACTIONS_DEPLOY_TOKEN: ${{ secrets.ACTIONS_DEPLOY_TOKEN }}
COMMIT_MESSAGE: ${{ env.commit_message }}
run: |
# Switch to main branch
git checkout main
# Clean up branch
git clean -df
# Restore files from backup
rsync -av $HOME/temp/* . --exclude=$HOME/temp/.git
rm -rf $HOME/temp
# Configure Git
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Commit and push changes
git add .
git commit -m "Deploying: $COMMIT_MESSAGE"
git push origin main
- name: Lychee Link Checker
uses: lycheeverse/lychee-action@v1
with:
args: -c lychee.toml -n .