Move Pages deploy into CI workflow
The release trigger in pages.yml never fires because events created by
GITHUB_TOKEN don't trigger other workflows. Instead of working around
this, inline the Pages deployment as a job in ci.yml that runs after
build, parallel to the Fly deploy.
Closes #8
https://claude.ai/code/session_01YUdY5FQHCAunQHXdgdFiME
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 081d8e0..673b650 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -7,9 +7,10 @@ on:
branches: [main]
permissions:
- actions: write
contents: write
+ id-token: write
packages: write
+ pages: write
jobs:
test:
@@ -24,6 +25,8 @@ jobs:
build:
needs: test
runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.meta.outputs.version }}
steps:
- uses: actions/checkout@v6
- uses: ruby/setup-ruby@v1
@@ -72,10 +75,6 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "${{ steps.meta.outputs.version }}" snapshots.tar.gz
- - if: github.ref == 'refs/heads/main' && github.event_name == 'push'
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: gh workflow run pages.yml --field tag=${{ steps.meta.outputs.version }}
deploy:
name: Deploy to Fly.io
@@ -92,3 +91,32 @@ jobs:
- run: flyctl deploy
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
+
+ pages:
+ name: Deploy to Pages
+ needs: build
+ if: github.ref == 'refs/heads/main' && github.event_name == 'push'
+ runs-on: ubuntu-latest
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ concurrency:
+ group: pages
+ cancel-in-progress: true
+ steps:
+ - uses: actions/checkout@v6
+ - uses: ruby/setup-ruby@v1
+ with:
+ bundler-cache: true
+ - env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+ mkdir -p gallery
+ gh release download "${{ needs.build.outputs.version }}" --pattern "snapshots.tar.gz" --output snapshots.tar.gz
+ tar xzf snapshots.tar.gz -C gallery
+ bundle exec rake "snapshots:gallery[gallery,gallery/index.html]"
+ - uses: actions/upload-pages-artifact@v3
+ with:
+ path: gallery
+ - id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
deleted file mode 100644
index 40fc503..0000000
--- a/.github/workflows/pages.yml
+++ /dev/null
@@ -1,45 +0,0 @@
-name: Pages
-
-on:
- workflow_dispatch:
- inputs:
- tag:
- description: Release tag to deploy (defaults to latest release)
- required: false
-
-permissions:
- contents: read
- pages: write
- id-token: write
-
-concurrency:
- group: pages
- cancel-in-progress: true
-
-jobs:
- deploy:
- runs-on: ubuntu-latest
- environment:
- name: github-pages
- url: ${{ steps.deployment.outputs.page_url }}
- steps:
- - uses: actions/checkout@v6
- - uses: ruby/setup-ruby@v1
- with:
- bundler-cache: true
- - env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- tag="${{ inputs.tag }}"
- if [ -z "$tag" ]; then
- tag="$(gh release view --json tagName -q .tagName)"
- fi
- mkdir -p gallery
- gh release download "$tag" --pattern "snapshots.tar.gz" --output snapshots.tar.gz
- tar xzf snapshots.tar.gz -C gallery
- bundle exec rake "snapshots:gallery[gallery,gallery/index.html]"
- - uses: actions/upload-pages-artifact@v3
- with:
- path: gallery
- - id: deployment
- uses: actions/deploy-pages@v4