add port-to-omp.mjs + Gitea Actions workflow (regenerate omp port on push)
Some checks failed
port-to-omp / port (push) Failing after 5s
Some checks failed
port-to-omp / port (push) Failing after 5s
This commit is contained in:
64
.gitea/workflows/port-to-omp.yml
Normal file
64
.gitea/workflows/port-to-omp.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
name: port-to-omp
|
||||
|
||||
# Regenerate the omp port of deepi-research from this repo and push it to
|
||||
# Mike/omp-deepi-research.
|
||||
#
|
||||
# Prerequisites on git.freno.me:
|
||||
# - an access token with write:repository scope, stored as the repo/org
|
||||
# secret GITEA_TOKEN (the workflow authenticates as `oauth2:<token>` over
|
||||
# https)
|
||||
# - a registered Actions runner (act_runner) for this repo
|
||||
#
|
||||
# Safe by construction: the port commit lands in the omp repo, never here, so
|
||||
# this workflow cannot re-trigger itself.
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
port:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
|
||||
- name: Port to omp
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
OMP_REPO: omp-deepi-research
|
||||
run: |
|
||||
set -euo pipefail
|
||||
URL="https://oauth2:${GITEA_TOKEN}@git.freno.me/Mike/${OMP_REPO}.git"
|
||||
|
||||
if git ls-remote "$URL" HEAD >/dev/null 2>&1; then
|
||||
git clone --depth 1 "$URL" omp-port
|
||||
git -C omp-port config user.name "omp-port"
|
||||
git -C omp-port config user.email "omp-port@freno.me"
|
||||
else
|
||||
git init -b main omp-port
|
||||
git -C omp-port remote add origin "$URL"
|
||||
git -C omp-port config user.name "omp-port"
|
||||
git -C omp-port config user.email "omp-port@freno.me"
|
||||
fi
|
||||
|
||||
# Regenerate the port directly into the omp checkout. The script
|
||||
# preserves .git, asserts every patch rule, and runs `bun install`
|
||||
# (refreshing bun.lock + node_modules).
|
||||
bun "$GITHUB_WORKSPACE/port-to-omp.mjs" --out "$PWD/omp-port"
|
||||
|
||||
cd omp-port
|
||||
# The port must compile against the pinned @oh-my-pi SDK before it
|
||||
# ships to users.
|
||||
bun run typecheck
|
||||
|
||||
if git diff --quiet HEAD; then
|
||||
echo "port unchanged; nothing to push"
|
||||
exit 0
|
||||
fi
|
||||
git add -A
|
||||
git commit -m "port: sync from ${GITHUB_REPOSITORY}@${GITHUB_SHA::8}"
|
||||
git push origin HEAD:main
|
||||
Reference in New Issue
Block a user