From ded13b529369b8fd91f927cdd5f7648af6f51d82 Mon Sep 17 00:00:00 2001 From: Dominic Rubas <1042243+rubas@users.noreply.github.com> Date: Sat, 14 Nov 2026 09:50:06 +0100 Subject: [PATCH] release: upload only the docs for a version that hex.pm lists A re-run of the publish job after a failed docs upload ran mix hex.publish again. Once an owner approved the staged release, Hex refused the package upload without --replace and skipped the docs, so the version stayed without docs. --- .github/workflows/release.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7787ee..d2869a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -473,11 +473,20 @@ jobs: run: mix run --no-start -e 'Code.ensure_loaded!(WhisperCpp.Native)' # With no Hex credential in the job, Hex publishes through the workload identity. A failed upload - # of the docs still exits 0, so the step reads the log. + # of the docs still exits 0, so the step reads the log. Hex refuses a second upload of a version + # that hex.pm lists, so for such a version, as one approved after a failed docs upload, the step + # uploads only the docs. - name: Publish the package and its docs shell: bash + env: + VERSION: ${{ needs.detect.outputs.version }} run: | - mix hex.publish --yes 2>&1 | tee "$RUNNER_TEMP/publish.log" + case "$(curl -sS -o /dev/null -w '%{http_code}' "https://hex.pm/api/packages/whisper_cpp/releases/$VERSION")" in + 404) ARGS=() ;; + 200) ARGS=(docs) ;; + *) echo "::error::hex.pm did not say whether it lists whisper_cpp $VERSION"; exit 1 ;; + esac + mix hex.publish "${ARGS[@]}" --yes 2>&1 | tee "$RUNNER_TEMP/publish.log" if grep -E 'Publishing (docs )?failed' "$RUNNER_TEMP/publish.log"; then exit 1 fi