Browse Source

fix(ci): publish dev-latest edit-first instead of probing for existence

The dev-latest publish step probed for the release with gh release
view before choosing edit or create. During the api.github.com 503
storm the probe itself failed, mis-routing an existing release into
the create path, which then died on a permanent 422 already-exists
error that no amount of retrying can fix.

The release exists on every run but the very first, so edit first and
fall back to create only when the edit fails. The retry log line now
names the gh subcommand instead of just the binary.
MHSanaei 8 giờ trước cách đây
mục cha
commit
2f156c8eb0
1 tập tin đã thay đổi với 5 bổ sung5 xóa
  1. 5 5
      .github/workflows/release.yml

+ 5 - 5
.github/workflows/release.yml

@@ -372,7 +372,7 @@ jobs:
           retry() {
             for i in 1 2 3 4 5; do
               "$@" && return 0
-              echo "attempt $i failed: $1" >&2
+              echo "attempt $i failed: ${*:1:3}" >&2
               sleep $((i * 5))
             done
             return 1
@@ -389,10 +389,10 @@ jobs:
           git tag -f dev-latest "${COMMIT}"
           retry git push -f origin refs/tags/dev-latest
 
-          if gh release view dev-latest >/dev/null 2>&1; then
-            retry gh release edit dev-latest --prerelease --latest=false \
-              --title "Dev build ${short}" --notes "${notes}"
-          else
+          # The release exists on every run but the first; edit-first avoids an
+          # existence probe that can 503 and mis-route into create (422).
+          if ! retry gh release edit dev-latest --prerelease --latest=false \
+              --title "Dev build ${short}" --notes "${notes}"; then
             retry gh release create dev-latest --prerelease --latest=false \
               --target "${COMMIT}" --title "Dev build ${short}" --notes "${notes}"
           fi