Merge pull request 'chore(release): prépare la v0.2.2' (#127) from chore/release-0.2.2 into main
This commit is contained in:
commit
5f27b4cd14
2 changed files with 23 additions and 7 deletions
28
.github/workflows/release.yml
vendored
28
.github/workflows/release.yml
vendored
|
|
@ -151,23 +151,39 @@ jobs:
|
|||
# propre à GitHub, pas répliquée par l'API Forgejo) — le corps de la
|
||||
# release reste minimal, cohérent avec l'absence d'outillage de
|
||||
# changelog ailleurs dans le repo.
|
||||
- name: Crée la Release Forgejo
|
||||
- name: Crée (ou récupère) la Release Forgejo
|
||||
id: create-release
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
api="$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases"
|
||||
body="$(printf '{"tag_name":"%s","name":"%s","draft":false,"prerelease":false}' "$GITHUB_REF_NAME" "$GITHUB_REF_NAME")"
|
||||
resp="$(curl -fsS -X POST "$api" \
|
||||
|
||||
# POST pour créer la release, code HTTP capturé à part. Si le tag est
|
||||
# déjà connu de Forgejo (tag poussé à la main avant ce workflow, ou
|
||||
# ré-exécution du job), l'API répond 409 : on réutilise alors la
|
||||
# release existante au lieu d'échouer — idempotence, cf. l'incident
|
||||
# du tag v0.2.2 poussé en avance qui a fait tomber ce job sur un 409.
|
||||
code="$(curl -sS -o /tmp/release.json -w '%{http_code}' -X POST "$api" \
|
||||
-H "Authorization: token $FORGEJO_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$body")"
|
||||
id="$(echo "$resp" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)"
|
||||
if [ -z "$id" ]; then
|
||||
echo "Réponse inattendue de l'API Release, pas d'id trouvé : $resp" >&2
|
||||
|
||||
if [ "$code" = "409" ]; then
|
||||
echo "Release $GITHUB_REF_NAME déjà existante (HTTP 409) — récupération de son id."
|
||||
curl -fsS "$api/tags/$GITHUB_REF_NAME" \
|
||||
-H "Authorization: token $FORGEJO_TOKEN" -o /tmp/release.json
|
||||
elif [ "$code" -lt 200 ] || [ "$code" -ge 300 ]; then
|
||||
echo "Échec de création de la Release (HTTP $code) : $(cat /tmp/release.json)" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Release $GITHUB_REF_NAME créée (id=$id)"
|
||||
|
||||
id="$(grep -o '"id":[0-9]*' /tmp/release.json | head -1 | cut -d: -f2)"
|
||||
if [ -z "$id" ]; then
|
||||
echo "Pas d'id de release trouvé : $(cat /tmp/release.json)" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Release $GITHUB_REF_NAME prête (id=$id)"
|
||||
echo "release-id=$id" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Attache l'APK à la Release
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "web",
|
||||
"version": "0.2.1",
|
||||
"version": "0.2.2",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue