Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions icons/svelte.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions pages/properties/sveltekit.properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "SvelteKit",
"description": "Build and deploy a static SvelteKit site to GitHub Pages.",
"iconName": "svelte",
"categories": ["Pages", "Svelte"]
}
87 changes: 87 additions & 0 deletions pages/sveltekit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Sample workflow for building and deploying a SvelteKit site to GitHub Pages
#
# To get started with SvelteKit see: https://svelte.dev/tutorial/
#
name: Deploy SvelteKit Site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: [$default-branch]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi

- name: Validate SvelteKit Adapter
run: |
if ! grep -q "@sveltejs/adapter-static" package.json; then
echo "::error title=Wrong Adapter Detected::GitHub Pages requires '@sveltejs/adapter-static'."
exit 1
fi

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: ${{ steps.detect-package-manager.outputs.manager }}

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Install Dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}

- name: Build with SvelteKit
run: ${{ steps.detect-package-manager.outputs.runner }} npm run build

- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Loading