Skip to content

Check if the release is published with the hex.pm API - #261

Merged
ericmj merged 1 commit into
mainfrom
fix-release-published-check
Nov 6, 2026
Merged

ericmj merged 1 commit into
mainfrom
fix-release-published-check

Conversation

@ericmj

@ericmj ericmj commented Nov 6, 2026

Copy link
Copy Markdown
Member

Since #259 the release workflow doesn't install the Hex archive, so the mix hex.info check in the publish step fails with The task "hex.info" could not be found on every push to main. The step treated that failure as "not published" and ran rebar3 hex publish, which hex.pm rejected for 0.21.1 in https://github.com/hexpm/hex_core/actions/runs/42227736305/job/127925415950.

The step now asks https://hex.pm/api/packages/hex_core/releases/$VERSION for its HTTP status. It publishes on a 404, skips on a 200, and fails the job on any other status or a connection error, so a failed check no longer leads to a publish. This also removes the leftover MIX_EXS: publish.exs.

The release workflow no longer installs the Hex archive, so `mix hex.info`
failed on every push to main and the step fell through to publishing.
Only publish on a 404 and fail the job on any other response.
else
rebar3 hex publish --yes --wait
fi
status=$(curl --silent --show-error --output /dev/null --write-out '%{http_code}' "https://hex.pm/api/packages/hex_core/releases/$VERSION")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@starbelly Would be great to have something like mix hex.info in rebar3_hex so we don't have to use curl here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Will take a swing at it this Saturday!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, added this hex to differentiate exit codes: hexpm/hex#1309

@ericmj
ericmj merged commit 5d09056 into main Nov 6, 2026
10 checks passed
@ericmj
ericmj deleted the fix-release-published-check branch November 6, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants