Skip to content

Commit

Permalink
CI: Fix GitHub Pages deployment.
Browse files Browse the repository at this point in the history
Instead of using a push to the `gh-pages` branch (and a third-party
workflow to do so), use the official actions for deploying directly from
a workflow artifact.
  • Loading branch information
kpreid committed Aug 23, 2024
1 parent 7eb86fb commit 605d361
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,8 @@ jobs:
# (but only for the stablest matrix version)
- name: Save wasm dist artifact
if: ${{ matrix.primary }}
uses: actions/upload-artifact@v4
uses: actions/upload-pages-artifact@v3
with:
name: wasm-dist
path: all-is-cubes-wasm/dist

- run: df -h .
Expand All @@ -199,8 +198,12 @@ jobs:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

# Do this only if we are pushing to main, not to pull requests.
# (Or if we're on a special 'pages-alt' branch, so we can experiment with
# deployment before pushing to main.)
Expand All @@ -210,20 +213,10 @@ jobs:
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/pages-alt') }}

steps:
- name: Download wasm dist artifact
uses: actions/download-artifact@v4
with:
name: wasm-dist
path: dist-for-deploy
# This action uses the artifact previously uploaded by actions/upload-pages-artifact
- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: gh-pages
build_dir: dist-for-deploy
keep_history: false
jekyll: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: deployment
uses: actions/deploy-pages@v4

# Run `xtask lint`.
#
Expand Down

0 comments on commit 605d361

Please sign in to comment.