diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index a33952d..ce8ac2e 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -46,31 +46,19 @@ jobs: REPO: ${{ github.repository }} run: | echo "Repository is private — removing existing Pages deployments" - - # List all deployments in the github-pages environment DEPLOYMENTS=$(gh api "repos/${REPO}/deployments?environment=github-pages&per_page=100" --jq '.[].id' 2>/dev/null || true) - if [ -z "$DEPLOYMENTS" ]; then echo "No existing Pages deployments found" exit 0 fi - - # Mark each deployment as inactive, then delete it for ID in $DEPLOYMENTS; do echo "Deactivating deployment ${ID}..." - gh api \ - --method POST \ - -H "Accept: application/vnd.github+json" \ - "repos/${REPO}/deployments/${ID}/statuses" \ - -f state=inactive 2>/dev/null || true - + gh api --method POST -H "Accept: application/vnd.github+json" \ + "repos/${REPO}/deployments/${ID}/statuses" -f state=inactive 2>/dev/null || true echo "Deleting deployment ${ID}..." - gh api \ - --method DELETE \ - -H "Accept: application/vnd.github+json" \ + gh api --method DELETE -H "Accept: application/vnd.github+json" \ "repos/${REPO}/deployments/${ID}" 2>/dev/null || true done - echo "All Pages deployments removed" # ── Build (only if public) ────────────────────────────────────── @@ -98,13 +86,8 @@ jobs: STAGE="_site_source" echo "::group::Staging allowed files" - - # ── Stage ONLY allowed files into a clean directory ─────────── - # Whitelist: *.md files + LICENSE + LICENSE.txt - # Everything else is excluded from the site. mkdir -p "${STAGE}" - # Copy all .md files preserving directory structure find . -name '*.md' \ -not -path './.git/*' \ -not -path "./${STAGE}/*" \ @@ -114,19 +97,16 @@ jobs: cp "$f" "$dest" done - # Copy LICENSE files (plain text) for lf in LICENSE LICENSE.txt; do [ -f "$lf" ] && cp "$lf" "${STAGE}/" done - # Remove any .gitkeep files that got copied find "${STAGE}" -name '.gitkeep' -delete echo "Staged files:" find "${STAGE}" -type f | sort echo "::endgroup::" - # ── Everything below operates inside the staging dir ────────── cd "${STAGE}" echo "::group::Generating Jekyll config and layout" @@ -156,8 +136,10 @@ jobs: