Deploy SvelteKit to GitHub Pages #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy SvelteKit to GitHub Pages | |
| on: | |
| workflow_dispatch: # allows manual trigger | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # 2 jobs: build the SvelteKit static site, and deploy the built site to GitHub Pages | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out the repo code | |
| - uses: actions/checkout@v4 | |
| # Use the Node version defined in .nvmrc | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| - name: Install dependencies | |
| run: npm i | |
| # Build the SvelteKit project | |
| - name: Build project | |
| run: npm run build | |
| # Upload build output as artifact | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./build # SvelteKit static output folder | |
| deploy: | |
| needs: build # make the build artifact available here in deploy job | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} # just a convenience, adds page url to action summary page | |
| steps: | |
| - id: deploy | |
| uses: actions/deploy-pages@v4 |