|
1 | | -# Workflow to build and deploy a SvelteKit website to GitHub Pages |
2 | | -name: Deploy static SvelteKit content to Pages |
| 1 | +name: Deploy to GitHub Pages |
3 | 2 |
|
4 | 3 | on: |
5 | | - # Runs on pushes targeting the default branch |
6 | 4 | push: |
7 | | - branches: ["main"] |
8 | | - |
9 | | - # Allows you to run this workflow manually from the Actions tab |
10 | | - workflow_dispatch: |
11 | | - |
12 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
13 | | -permissions: |
14 | | - contents: read |
15 | | - pages: write |
16 | | - id-token: write |
17 | | - |
18 | | -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
19 | | -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
20 | | -concurrency: |
21 | | - group: "pages" |
22 | | - cancel-in-progress: false |
| 5 | + branches: 'main' |
23 | 6 |
|
24 | 7 | jobs: |
25 | | - build-site: |
| 8 | + build_site: |
26 | 9 | runs-on: ubuntu-latest |
27 | 10 | steps: |
28 | 11 | - name: Checkout |
29 | 12 | uses: actions/checkout@v4 |
30 | | - |
31 | | - - name: Install pnpm |
32 | | - uses: pnpm/action-setup@v2 |
33 | | - with: |
34 | | - version: 8 |
35 | | - |
| 13 | + |
| 14 | + # If you're using pnpm, add this step then change the commands and cache key below to use `pnpm` |
| 15 | + # - name: Install pnpm |
| 16 | + # uses: pnpm/action-setup@v3 |
| 17 | + # with: |
| 18 | + # version: 8 |
| 19 | + |
36 | 20 | - name: Install Node.js |
37 | | - uses: actions/setup-node@v3 |
| 21 | + uses: actions/setup-node@v4 |
38 | 22 | with: |
39 | | - node-version: 18 |
40 | | - cache: pnpm |
41 | | - |
| 23 | + node-version: 20 |
| 24 | + cache: pnpm |
| 25 | + |
42 | 26 | - name: Install dependencies |
43 | | - run: pnpm i |
44 | | - |
45 | | - - name: Setup Pages |
46 | | - uses: actions/configure-pages@v4 |
47 | | - with: |
48 | | - static_site_generator: "sveltekit" |
49 | | - |
50 | | - - name: Build site |
51 | | - run: pnpm run build |
52 | | - |
53 | | - - name: Upload artifact |
| 27 | + run: pnpm install |
| 28 | + |
| 29 | + - name: build |
| 30 | + env: |
| 31 | + BASE_PATH: '/${{ github.event.repository.name }}' |
| 32 | + run: | |
| 33 | + pnpm build |
| 34 | + |
| 35 | + - name: Upload Artifacts |
54 | 36 | uses: actions/upload-pages-artifact@v3 |
55 | 37 | with: |
56 | | - path: 'build/' |
57 | | - |
| 38 | + # this should match the `pages` option in your adapter-static options |
| 39 | + path: 'build/' |
| 40 | + |
58 | 41 | deploy: |
59 | | - needs: build-site |
| 42 | + needs: build_site |
60 | 43 | runs-on: ubuntu-latest |
61 | | - |
| 44 | + |
| 45 | + permissions: |
| 46 | + pages: write |
| 47 | + id-token: write |
| 48 | + |
62 | 49 | environment: |
63 | 50 | name: github-pages |
64 | 51 | url: ${{ steps.deployment.outputs.page_url }} |
65 | | - |
| 52 | + |
66 | 53 | steps: |
67 | | - - name: Deploy to GitHub Pages |
| 54 | + - name: Deploy |
68 | 55 | id: deployment |
69 | 56 | uses: actions/deploy-pages@v4 |
0 commit comments