Skip to content

Commit 8f99a82

Browse files
authored
docs(hosting): Update snippet for GitHub pages workflow (#131)
1 parent c608c01 commit 8f99a82

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

guide/hosting.md

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,27 +149,51 @@ To deploy your slides on GitHub Pages:
149149

150150
```yaml
151151
name: Deploy pages
152-
on: push
152+
153+
on:
154+
workflow_dispatch: {}
155+
push:
156+
branches:
157+
- main
158+
153159
jobs:
154160
deploy:
155161
runs-on: ubuntu-latest
162+
163+
permissions:
164+
contents: read
165+
pages: write
166+
id-token: write
167+
168+
environment:
169+
name: github-pages
170+
url: ${{ steps.deployment.outputs.page_url }}
171+
156172
steps:
157173
- uses: actions/checkout@v3
174+
158175
- uses: actions/setup-node@v3
159176
with:
160-
node-version: '14'
177+
node-version: 'lts/*'
178+
161179
- name: Install dependencies
162180
run: npm install
181+
163182
- name: Install slidev
164183
run: npm i -g @slidev/cli
184+
165185
- name: Build
166186
run: slidev build --base <name_of_repo>
167-
- name: Deploy pages
168-
uses: crazy-max/ghaction-github-pages@v2
187+
188+
- uses: actions/configure-pages@v3
189+
190+
- uses: actions/upload-pages-artifact@v1
169191
with:
170-
build_dir: dist
171-
env:
172-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
192+
path: dist
193+
194+
- name: Deploy
195+
id: deployment
196+
uses: actions/deploy-pages@v2
173197
```
174198
- In your repository, go to Settings>Pages. Under "Build and deployment", select "Deploy from a branch", select "gh-pages" and "root". Click on save.
175199
- Finally, after all workflows are executed, a link to the slides should appear under Settings>Pages.

0 commit comments

Comments
 (0)