diff --git a/icons/svelte.svg b/icons/svelte.svg new file mode 100644 index 0000000000..acc92c2180 --- /dev/null +++ b/icons/svelte.svg @@ -0,0 +1,13 @@ + + + + diff --git a/pages/properties/sveltekit.properties.json b/pages/properties/sveltekit.properties.json new file mode 100644 index 0000000000..52cf2be316 --- /dev/null +++ b/pages/properties/sveltekit.properties.json @@ -0,0 +1,6 @@ +{ + "name": "SvelteKit", + "description": "Build and deploy a static SvelteKit site to GitHub Pages.", + "iconName": "svelte", + "categories": ["Pages", "Svelte"] +} \ No newline at end of file diff --git a/pages/sveltekit.yml b/pages/sveltekit.yml new file mode 100644 index 0000000000..8a6fb31591 --- /dev/null +++ b/pages/sveltekit.yml @@ -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 \ No newline at end of file