Skip to content

SvelteKit CI

SvelteKit CI #12

Workflow file for this run

name: SvelteKit CI
on:
schedule:
- cron: '0 0 * * *'
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
ci:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
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@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup jampack cache
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: actions/cache@v3
with:
path: '.jampack'
key: jampack
restore-keys: |
jampack
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm run lint
# - name: Test
# run: pnpm run test
- name: Prebuild
run: pnpm run prebuild
# FIXME: NASTY HACK!
- name: Build
run: timeout 60 pnpm run build || true
- name: Postbuild
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
run: pnpm run postbuild
- name: Publish to Cloudflare Pages
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
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'