SvelteKit CI #822
This file contains 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: 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 --with-deps | |
- name: Lint | |
run: pnpm run lint | |
- name: Setup jampack cache | |
uses: actions/cache@v4 | |
with: | |
path: .jampack | |
key: jampack | |
restore-keys: | | |
jampack | |
- name: Build | |
run: pnpm run build | |
- 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' |