diff --git a/.gitea/workflows/backfill.yml b/.gitea/workflows/backfill.yml new file mode 100644 index 0000000..7c09217 --- /dev/null +++ b/.gitea/workflows/backfill.yml @@ -0,0 +1,44 @@ +name: Backfill events (one-time) + +# Manual only (workflow_dispatch, no push trigger) - this is a one-time +# migration, not something that should run on every deploy. Runs the +# same backfill_events binary (src/bin/backfill_events.rs) that would +# otherwise need a `sudo`'d terminal session on the host to read +# /etc/app/uhhm-portal.env's secrets - the CI job already has them +# natively via secrets.PORTAL_NATS_URL, same source deploy.yml's +# "Write service env" step uses, so nothing needs reading off disk at +# all. Defaults to a dry run; check "apply" to actually write. + +on: + workflow_dispatch: + inputs: + apply: + description: "Actually write (unchecked = dry run, writes nothing)" + type: boolean + default: false + +jobs: + backfill: + runs-on: bare + env: + CARGO_HOME: /var/local/cargo + RUSTUP_HOME: /var/local/rustup + PATH: /var/local/cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/bin + SCCACHE_DIR: /var/local/sccache + SCCACHE_SERVER_PORT: "4228" + CARGO_TARGET_DIR: /var/local/cargo-target + NATS_URL: ${{ secrets.PORTAL_NATS_URL }} + steps: + - uses: actions/checkout@v4 + + - name: Build backfill_events + run: cargo build --release --features ssr --bin backfill_events + + - name: Run backfill + run: | + set -euo pipefail + if [ "${{ inputs.apply }}" = "true" ]; then + "$CARGO_TARGET_DIR/release/backfill_events" --apply + else + "$CARGO_TARGET_DIR/release/backfill_events" + fi