Replica of the reference start page: wallpaper, serif clock, search bar and link cards, as a TanStack Start app. - Better Auth: email/password and OIDC single sign-on - Postgres with Drizzle for the auth tables, cards, links, settings and uploaded wallpapers; the server applies the migrations on start - cards group links; links are dragged inside and between cards - search with DuckDuckGo, SearXNG or Google, suggestions and / commands - settings page: name, search engine, wallpaper, account - UI from collabry-components, copied into src/vendor/collabry - Dockerfile and a Gitea workflow that checks the code, builds the image for amd64 and arm64 and pushes it to the registry on main
96 lines
4.1 KiB
YAML
96 lines
4.1 KiB
YAML
# Checks the code and builds the image for linux/amd64 + linux/arm64. On main it PUSHES the image to the registry as
|
|
# $REGISTRY_PATH/web, tagged :<short sha> and :latest. Pull requests build without pushing.
|
|
#
|
|
# Same runner, registry and conventions as typst-workspace (its docs/adr/0008-gitea-ci-multiarch.md):
|
|
# - repository variable REGISTRY_PATH (registry/project, e.g. reg.nhaiden.io/dahoam)
|
|
# - secrets HARBOR_USERNAME / HARBOR_PASSWORD (robot account with push to that Harbor project)
|
|
# - the runner has no QEMU: the Dockerfile cross-builds, never install binfmt here
|
|
# - every action is pinned by commit SHA (tag in the comment)
|
|
name: images
|
|
|
|
on:
|
|
push:
|
|
branches: [main] # one run per commit: with '**' every PR commit would run twice on the single runner
|
|
pull_request:
|
|
|
|
# PRs: a newer push cancels the running build. main: never cancelled, so a push is never cut off halfway.
|
|
concurrency:
|
|
group: images-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1 (pnpm version: package.json packageManager)
|
|
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version: 26.13.1 # same as the image
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm typecheck
|
|
- run: pnpm lint
|
|
- run: pnpm test
|
|
|
|
image:
|
|
needs: check
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 45
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Decide tags and whether to push
|
|
id: meta
|
|
env:
|
|
REGISTRY_PATH: ${{ vars.REGISTRY_PATH }}
|
|
run: |
|
|
set -euo pipefail
|
|
[ -n "$REGISTRY_PATH" ] || { echo '::error::repository variable REGISTRY_PATH is not set'; exit 1; }
|
|
sha=${GITHUB_SHA::7}
|
|
image="$REGISTRY_PATH/web"
|
|
push=false; tags="$image:$sha"
|
|
if [ "$GITHUB_EVENT_NAME" = push ] && [ "$GITHUB_REF" = refs/heads/main ]; then
|
|
push=true; tags+=$'\n'"$image:latest"
|
|
fi
|
|
{
|
|
echo "push=$push"
|
|
echo "registry=${REGISTRY_PATH%%/*}"
|
|
echo "tags<<EOF"; echo "$tags"; echo "EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
echo "push=$push"; echo "$tags"
|
|
|
|
# A persistent BuildKit container (not removed after the job), so layer caches survive between runs on the
|
|
# single runner host. No binfmt/QEMU.
|
|
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
id: buildx
|
|
with:
|
|
name: dahoam-ci
|
|
driver-opts: image=moby/buildkit:v0.35.0@sha256:aa632b921ef07411d2cb77292cd34213d4f7b384001d6fceef1e1f25bf9752bb
|
|
cleanup: false
|
|
|
|
- name: Log in to the registry
|
|
if: steps.meta.outputs.push == 'true'
|
|
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
with:
|
|
registry: ${{ steps.meta.outputs.registry }}
|
|
username: ${{ secrets.HARBOR_USERNAME }}
|
|
password: ${{ secrets.HARBOR_PASSWORD }}
|
|
|
|
- name: Build (linux/amd64, linux/arm64) and push on main
|
|
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ steps.meta.outputs.push == 'true' }}
|
|
outputs: ${{ steps.meta.outputs.push != 'true' && 'type=cacheonly' || '' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: |
|
|
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
|
org.opencontainers.image.revision=${{ github.sha }}
|
|
|
|
# The persistent builder's cache otherwise grows without bound on the shared host (75 GB disk, it has been full).
|
|
- name: Cap the BuildKit cache
|
|
if: always() && steps.buildx.outcome == 'success'
|
|
run: docker buildx prune --builder dahoam-ci --max-used-space 3gb --force
|