ci(release): android-release is dispatch-only; a CI-created tag cannot wake it

Neither decoupled trigger fires on Forgejo 10.0.3: a tag created by the CI
(API or git push) is an Actions-user push and is not dispatched back into
Actions, and reusable workflows need Forgejo >= 12. The release procedure is
therefore two dispatches: release.yml, then android-release with that tag.
This commit is contained in:
sirius 2026-09-12 18:55:58 -04:00
commit 2cf055c1e8
No known key found for this signature in database
4 changed files with 73 additions and 50 deletions

View file

@ -4,10 +4,10 @@ name: release
# PR does not mint a release. A maintainer dispatches this at a stopping point
# (a batch of work has landed and CI is green on main) — see docs/RELEASING.md.
# Tag-push is intentionally NOT a trigger here: this workflow creates the tag
# itself and a tag-push hook would start a second run of the same release.
# The tag is created with a real `git push` (not POST /tags) precisely so that
# android-release.yml's `push: tags` trigger fires and the APK + AAR join the
# same release — an API-created tag sends no push event on this Forgejo.
# via the API, and a tag-push hook would start a second run of the same release.
# (A tag this workflow creates does not wake android-release.yml either — see
# docs/RELEASING.md: on this Forgejo, pushes made with the CI token are
# Actions-user events and are not dispatched back into Actions.)
# Version: explicit `version`, else `bump` off the newest v*.*.* tag
# (default minor — a batched release is usually a feature set); zero tags → v0.1.0.
on:
@ -60,15 +60,11 @@ jobs:
dry_run: ${{ steps.plan.outputs.dry_run }}
created_tag: ${{ steps.plan.outputs.created_tag }}
steps:
- name: Checkout source (needed to create the tag)
uses: https://code.forgejo.org/actions/checkout@v4
- name: Plan version, create tag unless dry_run
id: plan
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
REPO_API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
GIT_URL: ${{ github.server_url }}/${{ github.repository }}.git
EVENT_NAME: ${{ github.event_name }}
EVENT_SHA: ${{ github.sha }}
INPUT_BUMP: ${{ github.event.inputs.bump }}
@ -156,22 +152,23 @@ jobs:
fi
echo "tag $tag already exists on $sha — joining"
elif [ "$code" = "404" ]; then
# Create the tag with a real `git push`, not POST /tags.
# A tag pushed by git fires the `push: tags: v*.*.*` trigger
# that android-release.yml listens on; a tag created through
# the API does not (verified on this instance: the v0.2.0 tag
# created by POST /tags produced no android-release run).
git config user.name "onionwire-ci"
git config user.email "onionwire-ci@localhost"
git tag -a "$tag" "$sha" -m "OnionWire $tag"
push_url="https://sirius:${FORGEJO_TOKEN}@${GIT_URL#https://}"
if ! git push "$push_url" "refs/tags/$tag" 2>&1 \
| sed "s|${FORGEJO_TOKEN}|***|g"; then
echo "creating tag $tag on $sha failed" >&2
python3 -c "import json,sys; json.dump({'tag_name':sys.argv[1],'target':sys.argv[2],'message':'OnionWire '+sys.argv[1]}, sys.stdout)" \
"$tag" "$sha" > /tmp/tag-create.json
echo "tag-create payload $(wc -c < /tmp/tag-create.json) bytes"
create_code=$(api_curl -o /tmp/tag-created.json -w '%{http_code}' \
-X POST -H "Content-Type: application/json" \
--data-binary @/tmp/tag-create.json \
"$REPO_API/tags")
if [ "$create_code" = "201" ]; then
created=true
echo "created tag $tag on $sha"
elif [ "$create_code" = "409" ]; then
echo "tag $tag created concurrently — joining"
else
echo "creating tag $tag failed HTTP $create_code" >&2
cat /tmp/tag-created.json >&2 || true
exit 1
fi
created=true
echo "created tag $tag on $sha (git push)"
else
echo "GET tags/$tag failed HTTP $code" >&2
cat /tmp/tag.json >&2 || true