File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,10 +2,16 @@ name: Deploy SvelteKit to GitHub Pages
22
33on :
44 push :
5- branches : [svelte-ssg ]
5+ branches : [main ]
66
7+ permissions :
8+ contents : read
9+ pages : write
10+ id-token : write
11+
12+ # 2 jobs: build the SvelteKit static site, and deploy the built site to GitHub Pages
713jobs :
8- build-and-deploy :
14+ build :
915 runs-on : ubuntu-latest
1016
1117 steps :
@@ -18,17 +24,26 @@ jobs:
1824 node-version-file : .nvmrc
1925 cache : npm # cache node_modules for faster builds
2026
21- # Install dependencies exactly as in package-lock.json
2227 - name : Install dependencies
23- run : npm ci
28+ run : npm ci # ci (not install) to install exact versions from package-lock.json
2429
2530 # Build the SvelteKit project
2631 - name : Build project
2732 run : npm run build
2833
29- # Upload the build output to GitHub Pages
30- - name : Deploy to GitHub Pages
31- uses : peaceiris/actions-gh-pages@v4
34+ # Upload build output as artifact
35+ - uses : actions/upload-pages-artifact@v3
3236 with :
33- github_token : ${{ secrets.GITHUB_TOKEN }}
34- publish_dir : ./build # SvelteKit static output folder
37+ path : ./build # SvelteKit static output folder
38+
39+ deploy :
40+ needs : build # make the build artifact available here in deploy job
41+ runs-on : ubuntu-latest
42+
43+ environment :
44+ name : github-pages
45+ url : ${{ steps.deploy.outputs.page_url }} # just a convenience, adds page url to action summary page
46+
47+ steps :
48+ - id : deploy
49+ uses : actions/deploy-pages@v4
You can’t perform that action at this time.
0 commit comments