|
1 | | -name: Deploy to GitHub Pages |
| 1 | +# Workflow to build and deploy a SvelteKit website to GitHub Pages |
| 2 | +name: Deploy static SvelteKit content to Pages |
2 | 3 |
|
3 | 4 | on: |
| 5 | + # Runs on pushes targeting the default branch |
4 | 6 | push: |
5 | | - branches: 'main' |
| 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 |
6 | 23 |
|
7 | 24 | jobs: |
8 | | - build_site: |
| 25 | + build-site: |
9 | 26 | runs-on: ubuntu-latest |
10 | 27 | steps: |
11 | 28 | - name: Checkout |
12 | 29 | uses: actions/checkout@v4 |
13 | 30 |
|
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 | | - |
20 | 31 | - name: Install Node.js |
21 | | - uses: actions/setup-node@v4 |
| 32 | + uses: actions/setup-node@v3 |
22 | 33 | with: |
23 | | -node-version: 20 |
24 | | -cache: npm |
| 34 | + node-version: 20 |
| 35 | + cache: npm |
| 36 | + |
| 37 | + - name: Install dependencies |
| 38 | + run: pnpm i |
25 | 39 |
|
26 | | - - name: Install dependencies |
27 | | - run: npm install |
| 40 | + - name: Setup Pages |
| 41 | + uses: actions/configure-pages@v4 |
| 42 | + with: |
| 43 | + static_site_generator: "sveltekit" |
28 | 44 |
|
29 | | - - name: build |
30 | | - env: |
31 | | - BASE_PATH: '/${{ github.event.repository.name }}' |
32 | | - run: | |
33 | | - npm run build |
| 45 | + - name: Build site |
| 46 | + run: pnpm run build |
34 | 47 |
|
35 | | - - name: Upload Artifacts |
36 | | - uses: actions/upload-pages-artifact@v3 |
37 | | - with: |
38 | | - # this should match the `pages` option in your adapter-static options |
39 | | - path: 'build/' |
| 48 | + - name: Upload artifact |
| 49 | + uses: actions/upload-pages-artifact@v3 |
| 50 | + with: |
| 51 | + path: "build/" |
40 | 52 |
|
41 | 53 | deploy: |
42 | | - needs: build_site |
43 | | - runs-on: ubuntu-latest |
44 | | - |
45 | | - permissions: |
46 | | - pages: write |
47 | | - id-token: write |
| 54 | + needs: build-site |
| 55 | + runs-on: ubuntu-latest |
48 | 56 |
|
49 | | - environment: |
50 | | - name: github-pages |
51 | | - url: ${{ steps.deployment.outputs.page_url }} |
| 57 | + environment: |
| 58 | + name: github-pages |
| 59 | + url: ${{ steps.deployment.outputs.page_url }} |
52 | 60 |
|
53 | | - steps: |
54 | | - - name: Deploy |
55 | | - id: deployment |
56 | | - uses: actions/deploy-pages@v4 |
| 61 | + steps: |
| 62 | + - name: Deploy to GitHub Pages |
| 63 | + id: deployment |
| 64 | + uses: actions/deploy-pages@v4 |
0 commit comments