Files
loki/.github/workflows/app-secrets.yml
CatoandClaude d6fdc750f9 feat(ops): lightning-off, the way back for one app (#1579)
lightning-on all reached every app whose release carries AccountKit 0.26.1+,
including three whose sign-in other work owns right now (aoz-wohnen,
botsmann, vitareba). lightning-off removes the flag from one app and restarts
it; it refuses all.


Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9

Co-authored-by: Claude <noreply@anthropic.com>
2026-11-03 01:51:37 +01:00

85 lines
3.7 KiB
YAML

name: App secrets
# The secrets an app needs that no human holds — a cron bearer token, a Web
# Push key pair — generated and written into the app's env ON THE BOX, from
# GitHub, over the same SSH the deploy uses (HETZNER_SSH_KEY, HETZNER_IP).
# scripts/hetzner/app-secrets.sh is the registry and the rules: it adds only
# what is missing, never overwrites, prints names and never values (this repo
# is public, so these logs are too), and restarts the app only when it added
# something. With `crons` on, it then re-runs install-app-crons.sh so a timer
# that presents the new CRON_SECRET exists.
#
# signin-on turns on "Continue with <the providers Morulia publishes>" (the
# shared sign-in) in one app, or in every client with app=all: it adds
# SIGNIN_ISSUER and SIGNIN_CLIENT_ID beside the secret `ensure morulia`
# paired, and restarts the app. It refuses while Morulia lists no provider and
# skips an app on an AccountKit older than 0.24.0. It also runs by itself:
# Morulia's provider-keys.yml calls box-env-keys.yml, which syncs the provider
# keys pasted as Morulia's repository secrets and then runs signin-on all.
#
# Manual on purpose: it writes to the box.
# gh workflow run app-secrets.yml -f app=heidi -f action=ensure
# gh workflow run app-secrets.yml -f app=all -f action=signin-on -f crons=false
#
# lightning-on adds ACCOUNTKIT_LIGHTNING=1 (Lightning login, LNURL-auth) to one
# app, or with app=all to every app whose release runs AccountKit 0.26.1 or
# later, and restarts it. Nothing to pair: it needs no key.
# gh workflow run app-secrets.yml -f app=biaslens -f action=lightning-on -f crons=false
on:
workflow_dispatch:
inputs:
app:
description: "Register name of the app (apps.conf), e.g. heidi; `all` for signin-on or lightning-on"
required: true
default: heidi
action:
description: "show (names, set or not), ensure (add what is missing), signin-on (the Morulia button) or lightning-on (Lightning login, AccountKit 0.26.1+)"
required: true
default: show
type: choice
options: [show, ensure, signin-on, lightning-on, lightning-off]
crons:
description: "After ensure, (re)install the apps' systemd timers"
required: false
default: true
type: boolean
permissions:
contents: read
# Its own group, not deploy-prod: GitHub keeps ONE pending run per group and
# cancels the older one when another arrives, so a run of this queued behind a
# deploy was silently cancelled by the next deploy (first run, 2026-10-22). It
# touches one app's env and restarts that app; a deploy does not edit .env.
concurrency:
group: app-secrets-${{ inputs.app }}
cancel-in-progress: false
jobs:
app-secrets:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
HETZNER_IP: ${{ vars.HETZNER_IP }}
steps:
- uses: actions/checkout@v7
- name: SSH setup (same key and host as deploy.yml)
run: |
test -n "$HETZNER_IP" || { echo "::error::org variable HETZNER_IP is not set"; exit 1; }
mkdir -p ~/.ssh
printf '%s\n' "${{ secrets.HETZNER_SSH_KEY }}" > ~/.ssh/id_deploy
chmod 600 ~/.ssh/id_deploy
ssh-keyscan -H "$HETZNER_IP" >> ~/.ssh/known_hosts 2>/dev/null
printf 'Host %s\n IdentityFile ~/.ssh/id_deploy\n IdentitiesOnly yes\n' "$HETZNER_IP" >> ~/.ssh/config
- name: ${{ inputs.action }} ${{ inputs.app }}
env:
ACTION: ${{ inputs.action }}
APP: ${{ inputs.app }}
run: bash scripts/hetzner/app-secrets.sh "$ACTION" "$APP"
- name: Install the apps' timers
if: ${{ inputs.action == 'ensure' && inputs.crons }}
run: bash scripts/hetzner/install-app-crons.sh