Skip to content

SvelteKit CI

SvelteKit CI #771

Workflow file for this run

name: SvelteKit CI
on:
pull_request:
branches:
- main
push:
branches:
- main
schedule:
- cron: 0 0 * * *
workflow_dispatch: null
repository_dispatch:
jobs:
sveltekitci:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: '${{ env.STORE_PATH }}'
key: "${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}"
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Install playwright
run: pnpm exec playwright install
- name: Lint
run: pnpm run lint
- name: Setup jampack cache
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'Stadt-Geschichte-Basel/stadtgeschichtebasel.ch'
uses: actions/cache@v4
with:
path: .jampack
key: jampack
restore-keys: |
jampack
- name: Prebuild
run: pnpm run prebuild
- name: Build
run: pnpm run build
- name: Postbuild
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'Stadt-Geschichte-Basel/stadtgeschichtebasel.ch'
run: rm -Rf build/_jampack/ && pnpm run postbuild # FIXME: Quick fix to make jampack work
- name: Test
run: pnpm run test
- name: Publish to Cloudflare Pages
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'Stadt-Geschichte-Basel/stadtgeschichtebasel.ch'
uses: cloudflare/pages-action@v1
with:
apiToken: '${{ secrets.CLOUDFLARE_API_TOKEN }}'
accountId: '${{ secrets.CLOUDFLARE_ACCOUNT_ID }}'
projectName: stadtgeschichtebasel-ch
directory: build
# Optional: Enable this if you want to have GitHub Deployments triggered
# gitHubToken: '${{ secrets.GITHUB_TOKEN }}'
# Optional: Switch what branch you are publishing to.
# By default this will be the branch which triggered this workflow
branch: main
# Optional: Change the working directory
# workingDirectory: my-site
# Optional: Change the Wrangler version, allows you to point to a specific version or a tag such as `beta`
# wranglerVersion: '3'