Skip to content

Create the mod "Windows 7 Action Center Recreation" (#4763) #3493

Create the mod "Windows 7 Action Center Recreation" (#4763)

Create the mod "Windows 7 Action Center Recreation" (#4763) #3493

Workflow file for this run

name: Deploy static content
defaults:
run:
shell: bash
on:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: '2 0 * * *'
concurrency:
group: deploy-static-content
cancel-in-progress: true
env:
PYTHONUTF8: '1'
jobs:
run:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
cache-dependency-path: '.github/requirements.txt'
- name: Install Python dependencies
run: python -m pip install -r .github/requirements.txt
- name: Clone last deployed content
run: |
# The deployed content has image paths that are derived from URLs,
# which are case-sensitive, but CI runs on Windows, which is
# case-insensitive by default. Enable case-sensitive paths for the
# target folder before checking out into it, as subdirectories inherit
# the setting.
mkdir -p "${{ runner.temp }}/last_deploy"
fsutil.exe file setCaseSensitiveInfo "${{ runner.temp }}/last_deploy" enable
# Also tell git itself to treat paths case-sensitively, so it doesn't
# collapse image paths that differ only by case during checkout or,
# later, when staging the updated content for deployment. The setting
# persists in the clone's config and is reused by the deploy step.
git clone -c core.ignorecase=false --branch pages --depth 1 https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git "${{ runner.temp }}/last_deploy"
- name: Cache Windhawk
id: cache-windhawk
uses: actions/cache@v5
with:
path: ${{ runner.temp }}/windhawk
key: v1-${{ runner.os }}-1.7.3
- name: Extract Windhawk
if: steps.cache-windhawk.outputs.cache-hit != 'true'
run: |
installer_url="https://github.com/ramensoftware/windhawk/releases/download/v1.7.3/windhawk_setup.exe"
installer_path="${{ runner.temp }}/windhawk_setup.exe"
echo "Downloading $installer_url to $installer_path"
curl -L "$installer_url" -o "$installer_path"
extract_path="${{ runner.temp }}\windhawk"
echo "Extracting $installer_path to $extract_path"
MSYS_NO_PATHCONV=1 "$installer_path" /S /PORTABLE "/D=$extract_path"
- name: Install dependencies
run: npm install
- name: Prepare static content
run: npx tsx deploy.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WINDHAWK_MODS_LAST_DEPLOY_PATH: ${{ runner.temp }}\last_deploy
WINDHAWK_PATH: ${{ runner.temp }}\windhawk
- name: Archive mod images
run: |
# Image paths are derived from URLs, which are case-sensitive, but CI
# runs on Windows, which is case-insensitive by default. Enable
# case-sensitive paths for the images folder before creating anything
# inside it, as subdirectories inherit the setting.
mkdir -p images
fsutil.exe file setCaseSensitiveInfo images enable
# Copy last deployed images.
cp -R "${{ runner.temp }}/last_deploy/images/." images
# Archive new images.
python scripts/archive_mod_images.py
- name: Deploy
run: |
src_dir=.
deploy_dir="${{ runner.temp }}/last_deploy"
deploy_branch=pages
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
# echo Cloning the repository
# git clone --branch $deploy_branch --depth 1 --filter=blob:none --no-checkout https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.git "$deploy_dir"
echo Adding generated files to the repository
git --git-dir="$deploy_dir/.git" --work-tree="$src_dir" add -A
touch "$deploy_dir/.nojekyll"
git -C "$deploy_dir" add .nojekyll
echo Committing changes
git -C "$deploy_dir" diff-index --cached --quiet HEAD || git -C "$deploy_dir" commit -m "deploy: ${{ github.sha }}"
echo Pushing to GitHub
git -C "$deploy_dir" push origin $deploy_branch