Files
cinny/.gitea/workflows/trigger-desktop.yml
T
jared 81e1a25de6
CI / Build & Quality Checks (push) Successful in 11m46s
Trigger Desktop Build / trigger (push) Successful in 29s
fix(ci): trigger cinny-desktop build via Gitea contents API
Gitea suppresses workflow events from Actions runner pushes to prevent
infinite loops, so the submodule bump commit was never firing release.yml.
Add a second step that writes .cinny-version via the REST contents API —
that creates a user-attributed commit Gitea does not suppress.

The submodule bump is kept for correct SHA tracking; the API commit is
the actual trigger.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 19:31:42 -04:00

74 lines
3.2 KiB
YAML

name: Trigger Desktop Build
on:
push:
branches: [lotus]
jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Bump cinny submodule and trigger cinny-desktop build
env:
TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
CINNY_SHA="${{ github.sha }}"
echo "New cinny SHA: $CINNY_SHA"
# ── Step 1: check if cinny-desktop is already at this SHA ──────────
CURRENT=$(curl -sf \
"https://code.lotusguild.org/api/v1/repos/LotusGuild/cinny-desktop/contents/.cinny-version" \
-H "Authorization: token $TOKEN" 2>/dev/null || echo "{}")
CURRENT_SHA=$(echo "$CURRENT" | python3 -c \
"import sys,json,base64; d=json.load(sys.stdin); \
print(base64.b64decode(d['content']).decode().strip() if 'content' in d else '')" \
2>/dev/null || echo "")
if [ "$CURRENT_SHA" = "$CINNY_SHA" ]; then
echo "cinny-desktop already at $CINNY_SHA — nothing to do"
exit 0
fi
# ── Step 2: bump the git submodule pointer ──────────────────────────
git clone "https://x-access-token:$TOKEN@code.lotusguild.org/LotusGuild/cinny-desktop.git" desktop
cd desktop
git config user.email "ci@lotusguild.org"
git config user.name "Lotus CI"
git submodule update --init cinny
git -C cinny fetch origin
git -C cinny checkout "$CINNY_SHA"
git add cinny
if git diff --cached --quiet; then
echo "Submodule pointer already correct"
else
git commit -m "chore: bump cinny submodule to ${CINNY_SHA:0:8}"
git push origin main
echo "Submodule bump pushed"
fi
cd ..
# ── Step 3: update .cinny-version via Gitea contents API ────────────
# Actions-runner pushes don't trigger downstream workflows in Gitea.
# A REST API file update creates a real user-attributed commit that does.
FILE_SHA=$(echo "$CURRENT" | python3 -c \
"import sys,json; d=json.load(sys.stdin); print(d.get('sha',''))" \
2>/dev/null || echo "")
CONTENT=$(echo -n "$CINNY_SHA" | base64 -w 0)
if [ -n "$FILE_SHA" ]; then
curl -sf -X PUT \
"https://code.lotusguild.org/api/v1/repos/LotusGuild/cinny-desktop/contents/.cinny-version" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"message\":\"chore: trigger desktop build for cinny ${CINNY_SHA:0:8}\",\"content\":\"$CONTENT\",\"sha\":\"$FILE_SHA\"}"
else
curl -sf -X POST \
"https://code.lotusguild.org/api/v1/repos/LotusGuild/cinny-desktop/contents/.cinny-version" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"message\":\"chore: trigger desktop build for cinny ${CINNY_SHA:0:8}\",\"content\":\"$CONTENT\"}"
fi
echo "release.yml triggered via API commit"