Skip to content

Quality of life: Auto-run bun install when git pull or git merge is run locally #77

Quality of life: Auto-run bun install when git pull or git merge is run locally

Quality of life: Auto-run bun install when git pull or git merge is run locally #77

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build and upload to riff-raff
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6
with:
bun-version-file: '.bun-version'
- name: Install dependencies
# Dependabot updates dependencies, which can change the lockfile.
# Allow it to install without --frozen-lockfile so the updated lockfile can be committed.
run: |
if [ "${{ github.actor }}" = "dependabot[bot]" ]; then
bun install
else
bun install --frozen-lockfile
fi
- name: Check pinned dependencies
run: bun check:pinned-deps
- name: Check formatting
run: bun format:check
- name: Lint
# Force the Bun runtime (`--bun`) so ESLint runs under Bun instead of
# Node. The `import-x/order` rule classifies `bun:` imports as builtins
# only when it can read `process.versions.bun`, which is unset when the
# node-shebang `eslint` binary runs under Node (present on CI runners
# but not necessarily locally). Without this, `bun:test` import ordering
# differs between local and CI.
run: bun --bun run lint
- name: Typecheck
run: bun typecheck
- name: Test
run: bun test
- name: Build application
working-directory: src/apps/backend
run: bun run build:placeholder
- name: Build and synth CDK
working-directory: cdk
run: bun synth
- name: Combine application and CDK into dist
run: |
mkdir -p dist/frontend
cp -v src/apps/backend/dist/handler.js dist/
cp -v src/apps/backend/placeholder-assets/index.html dist/frontend
cd dist
zip -r dispatch.zip .
- name: Upload to riff-raff
uses: guardian/actions-riff-raff@ab360a150e2540439f7f675c37d170a2fd6c8604
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
roleArn: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
projectName: Editorial Tools::Dispatch
configPath: cdk/cdk.out/riff-raff.yaml
contentDirectories: |
cdk.out:
- cdk/cdk.out
dispatch:
- dist/dispatch.zip