Skip to content

Commit 4845a60

Browse files
authored
Deploy demo site directly with GitHub Actions (#821)
1 parent e319ab8 commit 4845a60

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

.github/workflows/build-demo.yml

+21-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Build Demo
2-
on: [push]
2+
on:
3+
push:
4+
branches: [ "main" ]
35
permissions:
46
contents: read
57

68
jobs:
7-
deploy:
8-
permissions:
9-
contents: write # for peaceiris/actions-gh-pages to push pages branch
9+
build:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Harden Runner
@@ -24,9 +24,21 @@ jobs:
2424
working-directory: ./demo
2525
- run: npm run build
2626
working-directory: ./demo
27-
- name: Publish Demo
28-
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
29-
if: ${{ github.ref == 'refs/heads/main' }}
27+
- name: Upload static files as artifact
28+
id: deployment
29+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
3030
with:
31-
github_token: ${{ secrets.GITHUB_TOKEN }}
32-
publish_dir: ./demo/static
31+
path: ./demo/static/
32+
deploy:
33+
needs: build
34+
permissions:
35+
pages: write
36+
id-token: write
37+
environment:
38+
name: github-pages
39+
url: ${{ steps.deployment.outputs.page_url }}
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Deploy to GitHub Pages
43+
id: deployment
44+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

0 commit comments

Comments
 (0)