privatecoffee-website/.forgejo/workflows/build-pride.yml
2025-05-02 08:35:06 +02:00

61 lines
1.8 KiB
YAML

name: Build and Deploy Pride-Theme Static Site
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
runs-on: docker
container: git.private.coffee/privatecoffee/static-site-builder:latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
python3 -m pip install -r requirements.txt --break-system-packages
- name: Generate static site
run: python3 main.py --theme pride --domains pride.coffee,www.pride.coffee
- name: Deploy to pages-pride branch
run: |
# Configure Git
git config --global user.name "Forgejo"
git config --global user.email "noreply@private.coffee"
# Move generated static site files to a temporary location
mv build ../static_site_temp
cp .gitignore ../static_site_temp
# Create a new orphan branch named 'pages-pride'
git checkout --orphan pages-pride
# Remove all files from the working directory
git rm -rf .
# Move the static site files back to the working directory
mv ../static_site_temp/* ./
mv ../static_site_temp/.* ./ 2>/dev/null || true
# Add and commit the static site files
git add .
git commit -m "Deploy static site"
# Set the URL again
git remote set-url origin "https://${{ secrets.FORGEJO_USER }}:${{ secrets.FORGEJO_TOKEN }}@git.private.coffee/PrivateCoffee/privatecoffee-website.git"
# Force push to the 'pages-pride' branch
git push origin pages-pride --force
- name: Save as artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
with:
name: static-site.zip
path: .