privatecoffee-website/.forgejo/workflows/build-dev.yml
Kumi 4f83a97f17
feat(build-dev): add --dev flag to generate static site
Added the --dev flag to the static site generation command in the build-dev workflow to ensure the development environment configurations are used during the build process. This change aims to align the build process with development-specific settings, enhancing consistency and correctness in the environment used for development builds.
2024-07-01 10:51:01 +02:00

49 lines
1.3 KiB
YAML

name: Build and Deploy Static Site
on:
push:
branches:
- dev
jobs:
build:
container: node:20-bookworm
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install dependencies
run: |
apt update
apt install -y python3 python3-pip
python3 -m pip install -r requirements.txt --break-system-packages
- name: Generate static site
run: python3 main.py --dev
- name: Deploy to pages 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
# Create a new orphan branch named 'pages-dev'
git checkout --orphan pages-dev
# 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"
# Force push to the 'pages-dev' branch
git push origin pages-dev --force