Publish images to GHCR and releases to the GitHub mirror
CI / build-and-scan (pull_request) Successful in 1m0s

- retag+push the same :latest/:X.Y/:X.Y.Z tags to ghcr.io/djeex/lumeex
- create a matching GitHub Release on the Djeex/lumeex mirror, same changelog
  body prefixed with a notice pointing back to the git.djeex.fr source repo
- targets the exact commit SHA (not the branch) with retries, since the
  Gitea->GitHub push mirror can lag behind this job
- requires a new GH_TOKEN secret (repo + write:packages) — not created yet
- first GHCR push per repo will be private by default; GitHub has no API to
  default it public for a personal account, needs a one-time manual toggle
This commit is contained in:
Djeex
2026-08-26 15:04:28 +02:00
parent 6eba3916b4
commit 4b90945871
+39
View File
@@ -185,6 +185,16 @@ jobs:
docker push "$IMAGE:$MINOR_TAG" docker push "$IMAGE:$MINOR_TAG"
docker push "$IMAGE:$VERSION" docker push "$IMAGE:$VERSION"
GHCR_IMAGE=ghcr.io/djeex/lumeex
echo "${{ secrets.GH_TOKEN }}" | docker login ghcr.io -u Djeex --password-stdin
docker tag lumeex:ci "$GHCR_IMAGE:latest"
docker tag lumeex:ci "$GHCR_IMAGE:$MINOR_TAG"
docker tag lumeex:ci "$GHCR_IMAGE:$VERSION"
docker push "$GHCR_IMAGE:latest"
docker push "$GHCR_IMAGE:$MINOR_TAG"
docker push "$GHCR_IMAGE:$VERSION"
TRIGGER_MSG=$(git log -1 --format=%s "${{ github.sha }}") TRIGGER_MSG=$(git log -1 --format=%s "${{ github.sha }}")
PR_NUM=$(echo "$TRIGGER_MSG" | grep -oE '#[0-9]+' | head -1 | tr -d '#' || true) PR_NUM=$(echo "$TRIGGER_MSG" | grep -oE '#[0-9]+' | head -1 | tr -d '#' || true)
@@ -244,3 +254,32 @@ jobs:
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "$JSON_PAYLOAD" \ -d "$JSON_PAYLOAD" \
"https://git.djeex.fr/api/v1/repos/Djeex/lumeex/releases" "https://git.djeex.fr/api/v1/repos/Djeex/lumeex/releases"
MIRROR_NOTICE="_This github repo is a mirror of https://git.djeex.fr/Djeex/lumeex. You'll find full package, PR, history and release note there._"
GH_BODY=$(printf '%s\n\n%s' "$MIRROR_NOTICE" "$BODY")
GH_JSON_PAYLOAD=$(jq -n \
--arg tag "$VERSION" \
--arg name "$VERSION" \
--arg body "$GH_BODY" \
--arg sha "${{ github.sha }}" \
'{tag_name: $tag, name: $name, target_commitish: $sha, body: $body}')
GH_STATUS=0
for i in 1 2 3 4 5; do
GH_STATUS=$(curl -s -o /tmp/gh_release.json -w "%{http_code}" -X POST \
-H "Authorization: Bearer ${{ secrets.GH_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-H "Content-Type: application/json" \
-d "$GH_JSON_PAYLOAD" \
"https://api.github.com/repos/Djeex/lumeex/releases")
if [ "$GH_STATUS" = "201" ]; then
break
fi
echo "GitHub Release attempt $i failed (HTTP $GH_STATUS) — mirror may not have synced this commit yet, retrying in 15s..."
sleep 15
done
echo "GitHub Release API response: $GH_STATUS"
if [ "$GH_STATUS" != "201" ]; then
cat /tmp/gh_release.json 2>/dev/null || true
fi