diff --git a/.gitea/workflows/dispatch-css-sync.yml b/.gitea/workflows/dispatch-css-sync.yml deleted file mode 100644 index fe233e7..0000000 --- a/.gitea/workflows/dispatch-css-sync.yml +++ /dev/null @@ -1,111 +0,0 @@ -# When MokoOnyx CSS changes hit main: -# 1. Sync base CSS to Template-Client-WaaS (the single source for clients) -# 2. If new CSS variables were added, create issues on individual client repos -name: Sync CSS to Client Template - -on: - push: - branches: [main] - paths: - - 'src/media/templates/site/mokoonyx/css/**' - - 'media/templates/site/mokoonyx/css/**' - -permissions: - contents: read - -jobs: - sync: - name: Sync to Template and Notify Clients - runs-on: ubuntu-latest - steps: - - name: Checkout MokoOnyx - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Sync CSS to Template-Client-WaaS - env: - GITEA_TOKEN: ${{ secrets.GA_TOKEN }} - run: | - API="${{ github.server_url }}/api/v1" - AUTH="Authorization: token ${GITEA_TOKEN}" - TEMPLATE="MokoConsulting/Template-Client-WaaS" - - CSS_DIR="src/media/templates/site/mokoonyx/css" - [ ! -d "$CSS_DIR" ] && CSS_DIR="media/templates/site/mokoonyx/css" - - # Sync base CSS files only (user.css and *.custom.css are client-owned) - find "$CSS_DIR" -name "*.css" -not -name "user.css" -not -name "*.custom.css" | while read -r file; do - rel_path="src/media/templates/site/mokoonyx/css/${file#${CSS_DIR}/}" - content_b64=$(base64 -w0 "$file") - sha=$(curl -sf -H "$AUTH" "${API}/repos/${TEMPLATE}/contents/${rel_path}" | jq -r '.sha // empty') - - if [ -n "$sha" ]; then - curl -sf -X PUT -H "$AUTH" -H "Content-Type: application/json" \ - "${API}/repos/${TEMPLATE}/contents/${rel_path}" \ - -d "{\"content\": \"${content_b64}\", \"sha\": \"${sha}\", \"message\": \"chore: sync CSS from MokoOnyx\"}" \ - -o /dev/null && echo "Updated: ${rel_path}" - else - curl -sf -X POST -H "$AUTH" -H "Content-Type: application/json" \ - "${API}/repos/${TEMPLATE}/contents/${rel_path}" \ - -d "{\"content\": \"${content_b64}\", \"message\": \"chore: sync CSS from MokoOnyx\"}" \ - -o /dev/null && echo "Created: ${rel_path}" - fi - done - - - name: Extract all CSS variables from MokoOnyx base - id: vars - env: - GITEA_TOKEN: ${{ secrets.GA_TOKEN }} - run: | - API="${{ github.server_url }}/api/v1" - AUTH="Authorization: token ${GITEA_TOKEN}" - - CSS_DIR="src/media/templates/site/mokoonyx/css" - [ ! -d "$CSS_DIR" ] && CSS_DIR="media/templates/site/mokoonyx/css" - - # Get ALL variables defined in MokoOnyx base CSS (excluding custom files) - ALL_VARS=$(find "$CSS_DIR" -name "*.css" -not -name "*.custom.css" -not -name "user.css" -exec grep -ohE '\-\-[a-z][a-z0-9-]+' {} \; | sort -u) - echo "$ALL_VARS" > /tmp/all_vars.txt - echo "Total base variables: $(wc -l < /tmp/all_vars.txt)" - - # Check each client repo for missing variables - CLIENTS=( - "ClarksvilleFurs/client-waas-clarksvillefurs" - "KiddieLand/client-waas-kiddieland" - "VexCreations/client-waas-vexcreations" - ) - - for repo in "${CLIENTS[@]}"; do - echo "=== Checking ${repo} ===" - MISSING="" - - for theme in "dark" "light"; do - FILE_PATH="src/media/templates/site/mokoonyx/css/theme/${theme}.custom.css" - CLIENT_CSS=$(curl -sf -H "$AUTH" "${API}/repos/${repo}/contents/${FILE_PATH}" | jq -r '.content // empty' | base64 -d 2>/dev/null || echo "") - - if [ -z "$CLIENT_CSS" ]; then - MISSING="$MISSING\nAll variables missing from ${theme}.custom.css (file not found)" - continue - fi - - # Find variables in base that are NOT in client custom file - while read -r var; do - [ -z "$var" ] && continue - if ! echo "$CLIENT_CSS" | grep -qF "$var"; then - MISSING="$MISSING\n- \`${var}\` missing from ${theme}.custom.css" - fi - done < /tmp/all_vars.txt - done - - if [ -n "$MISSING" ]; then - BODY="Your theme custom files are missing CSS variables defined in MokoOnyx base.\n\n## Missing Variables\n${MISSING}\n\n## Action\n\nAdd these variables to your \`dark.custom.css\` and/or \`light.custom.css\` with appropriate values for your theme.\n\nBase CSS reference: ${{ github.server_url }}/MokoConsulting/MokoOnyx/src/branch/main/src/media/templates/site/mokoonyx/css" - - curl -sf -X POST -H "$AUTH" -H "Content-Type: application/json" \ - "${API}/repos/${repo}/issues" \ - -d "$(jq -n --arg t "chore: CSS variables out of sync with MokoOnyx" --arg b "$BODY" '{title:$t,body:$b}')" \ - -o /dev/null && echo "Issue created: ${repo}" - else - echo " All variables present" - fi - done