From b7ec075a6e142225120a2a17b5ee30c3d7bb84b7 Mon Sep 17 00:00:00 2001 From: Pratik Patel Date: Sat, 7 Mar 2026 18:44:15 -0500 Subject: [PATCH 1/3] Add daily docs release workflow Creates a GitHub Actions workflow that: - Runs daily at 6:00 AM UTC with manual dispatch for first run - Zips docs/ (Markdown) and html/docs/ (HTML) into a single archive - Only creates a new release if content has changed in the last 24 hours - Names zip as Git-Going-With-Git-yyyy-mm-dd.zip - Tags releases as vyyyy-mm-dd and marks latest - Retains only the 10 most recent releases --- .github/workflows/docs-release.yml | 90 ++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .github/workflows/docs-release.yml diff --git a/.github/workflows/docs-release.yml b/.github/workflows/docs-release.yml new file mode 100644 index 0000000..912d2d1 --- /dev/null +++ b/.github/workflows/docs-release.yml @@ -0,0 +1,90 @@ +name: Docs Release + +on: + schedule: + - cron: '0 6 * * *' # Daily at 6:00 AM UTC + workflow_dispatch: # Allow manual trigger for first run after PR approval + +permissions: + contents: write + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if docs have changed since last release + id: changes + run: | + # On manual dispatch (first run), always build + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + echo "First run (manual dispatch) — building unconditionally." + exit 0 + fi + + # For scheduled runs, check if docs/ or html/docs/ changed in the last 24 hours + LAST_CHANGE=$(git log --since="24 hours ago" --format="%H" -- docs/ html/docs/ | head -1) + if [ -n "$LAST_CHANGE" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + echo "Changes detected in docs/ or html/docs/." + else + echo "changed=false" >> "$GITHUB_OUTPUT" + echo "No changes detected — skipping release." + fi + + - name: Set date tag + if: steps.changes.outputs.changed == 'true' + id: date + run: | + DATE=$(date -u +"%Y-%m-%d") + echo "date=$DATE" >> "$GITHUB_OUTPUT" + echo "tag=v$DATE" >> "$GITHUB_OUTPUT" + echo "zip_name=Git-Going-With-Git-$DATE.zip" >> "$GITHUB_OUTPUT" + + - name: Create zip of docs and html/docs + if: steps.changes.outputs.changed == 'true' + run: | + zip -r "${{ steps.date.outputs.zip_name }}" docs/ html/docs/ + + - name: Delete existing release for today if it exists + if: steps.changes.outputs.changed == 'true' + run: | + gh release delete "${{ steps.date.outputs.tag }}" --yes --cleanup-tag 2>/dev/null || true + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create GitHub release + if: steps.changes.outputs.changed == 'true' + run: | + gh release create "${{ steps.date.outputs.tag }}" \ + "${{ steps.date.outputs.zip_name }}" \ + --title "Docs Release ${{ steps.date.outputs.date }}" \ + --notes "Daily docs release for ${{ steps.date.outputs.date }}. Contains docs/ (Markdown) and html/docs/ (HTML)." \ + --latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Clean up old releases (keep last 10) + if: steps.changes.outputs.changed == 'true' + run: | + # List all releases sorted by date (newest first), skip the first 10 + RELEASES_TO_DELETE=$(gh release list --limit 100 --json tagName,createdAt \ + --jq 'sort_by(.createdAt) | reverse | .[10:] | .[].tagName' \ + | grep -E '^v[0-9]{4}-[0-9]{2}-[0-9]{2}$' || true) + + if [ -z "$RELEASES_TO_DELETE" ]; then + echo "No old releases to clean up." + else + for TAG in $RELEASES_TO_DELETE; do + echo "Deleting release $TAG..." + gh release delete "$TAG" --yes --cleanup-tag 2>/dev/null || true + done + fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From b9ff3ef0e987affbeaff21a59cff3d1c0daa2107 Mon Sep 17 00:00:00 2001 From: Pratik Patel Date: Sat, 7 Mar 2026 18:59:21 -0500 Subject: [PATCH 2/3] Compare docs changes against last release tag instead of 24h window Uses the most recent vyyyy-mm-dd release tag as the baseline for change detection. This avoids missing changes if a scheduled run is skipped due to runner outages or cron delays. --- .github/workflows/docs-release.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs-release.yml b/.github/workflows/docs-release.yml index 912d2d1..28f6f87 100644 --- a/.github/workflows/docs-release.yml +++ b/.github/workflows/docs-release.yml @@ -28,14 +28,21 @@ jobs: exit 0 fi - # For scheduled runs, check if docs/ or html/docs/ changed in the last 24 hours - LAST_CHANGE=$(git log --since="24 hours ago" --format="%H" -- docs/ html/docs/ | head -1) - if [ -n "$LAST_CHANGE" ]; then + # For scheduled runs, compare against the last release tag + LAST_TAG=$(git tag --list 'v[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]' --sort=-version:refname | head -1) + if [ -z "$LAST_TAG" ]; then echo "changed=true" >> "$GITHUB_OUTPUT" - echo "Changes detected in docs/ or html/docs/." + echo "No previous release tag found — building unconditionally." + exit 0 + fi + + DIFF=$(git diff --name-only "$LAST_TAG"..HEAD -- docs/ html/docs/) + if [ -n "$DIFF" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + echo "Changes detected since $LAST_TAG in docs/ or html/docs/." else echo "changed=false" >> "$GITHUB_OUTPUT" - echo "No changes detected — skipping release." + echo "No changes since $LAST_TAG — skipping release." fi - name: Set date tag From 7150ea2427a500e43cf59154362305cc41969ddc Mon Sep 17 00:00:00 2001 From: Pratik Patel Date: Sat, 7 Mar 2026 19:11:53 -0500 Subject: [PATCH 3/3] Add concurrency group to prevent overlapping docs releases Serializes workflow runs so a manual dispatch during a scheduled run cannot race on tag deletion and release creation. --- .github/workflows/docs-release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docs-release.yml b/.github/workflows/docs-release.yml index 28f6f87..40ea19d 100644 --- a/.github/workflows/docs-release.yml +++ b/.github/workflows/docs-release.yml @@ -8,6 +8,10 @@ on: permissions: contents: write +concurrency: + group: docs-release + cancel-in-progress: false + jobs: build-and-release: runs-on: ubuntu-latest