-
-
Notifications
You must be signed in to change notification settings - Fork 10
Add manual GitHub Pages republish workflow #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,99 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Manually republish the Sparkle appcast to GitHub Pages. | ||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||
| # Use this when the Pages custom domain changes or when you need to redeploy | ||||||||||||||||||||||||||||||||||||||||||||||||
| # without cutting a new release. It downloads the appcast.xml from the latest | ||||||||||||||||||||||||||||||||||||||||||||||||
| # GitHub Release and publishes it to Pages with the configured CNAME. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| name: Republish Pages | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||||||||||||||||||||||||||||
| custom_domain: | ||||||||||||||||||||||||||||||||||||||||||||||||
| description: "Custom domain for the CNAME file (e.g. updates.tabbyapp.dev)" | ||||||||||||||||||||||||||||||||||||||||||||||||
| required: true | ||||||||||||||||||||||||||||||||||||||||||||||||
| default: "updates.tabbyapp.dev" | ||||||||||||||||||||||||||||||||||||||||||||||||
| type: string | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||
| contents: read | ||||||||||||||||||||||||||||||||||||||||||||||||
| pages: write | ||||||||||||||||||||||||||||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| concurrency: | ||||||||||||||||||||||||||||||||||||||||||||||||
| group: pages | ||||||||||||||||||||||||||||||||||||||||||||||||
| cancel-in-progress: false | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||
| republish: | ||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||||||||||||||||||||||
| name: github-pages | ||||||||||||||||||||||||||||||||||||||||||||||||
| url: ${{ steps.deploy.outputs.page_url }} | ||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Download appcast.xml from latest release | ||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ github.token }} | ||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Find the latest release that has an appcast in its artifacts. | ||||||||||||||||||||||||||||||||||||||||||||||||
| # The release workflow uploads appcast.xml inside the release-artifacts bundle, | ||||||||||||||||||||||||||||||||||||||||||||||||
| # but it also publishes appcast.xml to Pages. We can reconstruct it from the | ||||||||||||||||||||||||||||||||||||||||||||||||
| # release assets or fall back to the repo's existing Pages deployment. | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| # Try downloading from the latest release artifacts | ||||||||||||||||||||||||||||||||||||||||||||||||
| LATEST_RUN=$(gh run list \ | ||||||||||||||||||||||||||||||||||||||||||||||||
| --repo "${{ github.repository }}" \ | ||||||||||||||||||||||||||||||||||||||||||||||||
| --workflow release.yml \ | ||||||||||||||||||||||||||||||||||||||||||||||||
| --status success \ | ||||||||||||||||||||||||||||||||||||||||||||||||
| --limit 1 \ | ||||||||||||||||||||||||||||||||||||||||||||||||
| --json databaseId \ | ||||||||||||||||||||||||||||||||||||||||||||||||
| --jq '.[0].databaseId') | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$LATEST_RUN" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Downloading appcast from release run $LATEST_RUN" | ||||||||||||||||||||||||||||||||||||||||||||||||
| gh run download "$LATEST_RUN" \ | ||||||||||||||||||||||||||||||||||||||||||||||||
| --repo "${{ github.repository }}" \ | ||||||||||||||||||||||||||||||||||||||||||||||||
| --name release-artifacts \ | ||||||||||||||||||||||||||||||||||||||||||||||||
| --dir artifacts/ || true | ||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -f artifacts/appcast.xml ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Found appcast.xml from release artifacts" | ||||||||||||||||||||||||||||||||||||||||||||||||
| cp artifacts/appcast.xml appcast.xml | ||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "::error::No appcast.xml found in latest release artifacts. Run a full release first." | ||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Prepare Pages artifact | ||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p pages/Cotabby | ||||||||||||||||||||||||||||||||||||||||||||||||
| cp appcast.xml pages/appcast.xml | ||||||||||||||||||||||||||||||||||||||||||||||||
| cp appcast.xml pages/Cotabby/appcast.xml | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+73
to
+75
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||
| printf '%s\n' "${{ inputs.custom_domain }}" > pages/CNAME | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Configure GitHub Pages | ||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/configure-pages@v5 | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Upload GitHub Pages artifact | ||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/upload-pages-artifact@v3 | ||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||
| path: pages | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Deploy GitHub Pages | ||||||||||||||||||||||||||||||||||||||||||||||||
| id: deploy | ||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/deploy-pages@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Summary | ||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "### Pages Republished" | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "| Field | Value |" | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "|-------|-------|" | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "| Custom domain | ${{ inputs.custom_domain }} |" | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "| Appcast URL | https://${{ inputs.custom_domain }}/appcast.xml |" | ||||||||||||||||||||||||||||||||||||||||||||||||
| echo "| Pages URL | ${{ steps.deploy.outputs.page_url }} |" | ||||||||||||||||||||||||||||||||||||||||||||||||
| } >> "${GITHUB_STEP_SUMMARY}" | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+90
to
+99
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
artifacts/appcast.xml, butactions/upload-artifact@v4preserves the workspace-relative directory structure when uploading. Inrelease.yml, the file is staged atbuild/appcast.xml, so whengh run download --dir artifacts/extracts the artifact, the file lands atartifacts/build/appcast.xml— notartifacts/appcast.xml. The condition will always be false and the workflow will always exit with the "No appcast.xml found" error.