From 2d602bdc5699c9df330a098d6191d9c0cc4ec7e8 Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 24 Sep 2024 08:04:46 +0200 Subject: [PATCH] feat: add CI for building and deploying Pride theme site Set up a new GitHub Actions workflow to automate the build and deployment of the static site with the Pride theme on pushes to the main branch. This includes checking out the repository, installing dependencies, generating the site, and deploying to a new 'pages-pride' branch. Ensures streamlined and consistent deployment aligned with updates. --- .forgejo/workflows/build-pride.yml | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .forgejo/workflows/build-pride.yml diff --git a/.forgejo/workflows/build-pride.yml b/.forgejo/workflows/build-pride.yml new file mode 100644 index 0000000..5d0c1d3 --- /dev/null +++ b/.forgejo/workflows/build-pride.yml @@ -0,0 +1,50 @@ +name: Build and Deploy Static Site (Pride Theme) + +on: + push: + branches: + - main + +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 + + - 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 + 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" + + # Force push to the 'pages-pride' branch + git push origin pages-pride --force