Fix release feed deployment precedence #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Pages | |
| # Builds website/ (React + Vite) and publishes the build output directly to GitHub Pages on | |
| # every push to main; nothing under docs/ is tracked in git. One-time setup: repo | |
| # Settings → Pages → Source → "GitHub Actions". | |
| on: | |
| push: | |
| branches: [main] | |
| paths: ['website/**', '.github/workflows/pages.yml'] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| # Serialize with the release workflow's appcast deployment. A normal site edit must never cancel | |
| # or overwrite the feed while a signed release is being published. | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@c915c33a16f01166c17c4e35fe1d4085a2d71adb # v4 | |
| - name: Preserve the currently deployed Sparkle feed | |
| run: | | |
| live="$RUNNER_TEMP/live-appcast.xml" | |
| if curl -fsSL --retry 3 --retry-delay 2 --connect-timeout 15 --max-time 60 \ | |
| "https://augani.github.io/dory/appcast.xml?preserve=${{ github.run_id }}" \ | |
| -o "$live" \ | |
| && python3 - "$live" website/public/appcast.xml <<'PY' | |
| import sys | |
| import xml.etree.ElementTree as ET | |
| sparkle = "http://www.andymatuschak.org/xml-namespaces/sparkle" | |
| def release_item(path): | |
| item = ET.parse(path).getroot().find("./channel/item") | |
| assert item is not None, f"{path} has no release item" | |
| assert item.findtext(f"{{{sparkle}}}minimumSystemVersion") == "14.0", \ | |
| f"{path} has an invalid macOS floor" | |
| return item | |
| live_item = release_item(sys.argv[1]) | |
| checked_item = release_item(sys.argv[2]) | |
| live_build = int(live_item.findtext(f"{{{sparkle}}}version")) | |
| checked_build = int(checked_item.findtext(f"{{{sparkle}}}version")) | |
| assert live_build >= checked_build, \ | |
| f"checked-in appcast build {checked_build} is newer than live build {live_build}" | |
| PY | |
| then | |
| cp "$live" website/public/appcast.xml | |
| else | |
| echo "Live appcast is missing, invalid, or older; retaining the checked-in release feed." | |
| fi | |
| - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: website/package-lock.json | |
| - run: npm ci | |
| working-directory: website | |
| - run: npm run lint | |
| working-directory: website | |
| - run: npm run build | |
| working-directory: website | |
| - uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5 | |
| - uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3 | |
| with: | |
| path: docs-build | |
| - id: deployment | |
| uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 |