85 lines
3.1 KiB
YAML
85 lines
3.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [dev]
|
|
pull_request:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint-check-build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: .nvmrc
|
|
|
|
- name: Install dependencies
|
|
run: corepack enable && pnpm i --frozen-lockfile
|
|
|
|
- name: Lint
|
|
run: pnpm run lint
|
|
|
|
- name: Check
|
|
run: pnpm run check
|
|
|
|
- name: Check desktop TypeScript
|
|
run: |
|
|
npm ci --prefix electron --ignore-scripts
|
|
npm --prefix electron run build
|
|
|
|
- name: Build
|
|
if: github.event_name != 'pull_request'
|
|
run: pnpm run build
|
|
|
|
# On a pull request the same build doubles as the preview build: same
|
|
# command, just pointed at the preview origin and with production
|
|
# analytics stripped out. The preview server downloads the artifact
|
|
# produced below; it never checks out or builds a pull request itself,
|
|
# so contributor code only ever executes here, in the runner.
|
|
#
|
|
# The hostname is spelled out rather than templated so that what gets
|
|
# deployed is readable from this file alone. It is one of two places to
|
|
# change if previews move (the other is PREVIEW_DOMAIN on the server).
|
|
- name: Build preview
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
VITE_PLATFORM_URL: https://pr-${{ github.event.number }}.preview.flowboat.lol
|
|
VITE_PLATFORM_NAME: "Flotilla PR #${{ github.event.number }}"
|
|
VITE_PLATFORM_DESCRIPTION: "Preview build of coracle/flotilla PR #${{ github.event.number }}. Not the real Flotilla."
|
|
VITE_CARTO_BASEMAP_KEY: cb1_42g1_2_bc3246a5d40392210ca7ab64
|
|
run: |
|
|
export VITE_BUILD_HASH="${HEAD_SHA:0:8}"
|
|
pnpm run build
|
|
|
|
# src/app.html carries a plausible tag pointed at production analytics,
|
|
# whatever its data-domain says; a preview must not report into them.
|
|
perl -0777 -i -pe \
|
|
's|<script\s+defer\s+data-domain="[^"]*"\s+src="https://plausible\.coracle\.social/[^"]*"\s*></script>||gs' \
|
|
build/index.html
|
|
|
|
# v3, not v4, on purpose: actions/upload-artifact@v4 fails on this Gitea
|
|
# with "GHESNotSupportedError". @actions/artifact v2 decides an instance
|
|
# is GHES purely from GITHUB_SERVER_URL's hostname not being github.com,
|
|
# which is always true here, and the runner overwrites any step-level
|
|
# override of that variable. v3 works, and the preview server fetches
|
|
# the result through the run's artifact download route.
|
|
# (Verified on gitea.coracle.social, act_runner v0.6.1, 2026-09-01.)
|
|
- name: Upload preview
|
|
if: github.event_name == 'pull_request'
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: preview
|
|
path: build
|
|
retention-days: 7
|
|
if-no-files-found: error
|
|
|