8000 Let the publishing to crates.io be re-run after a failure by dominion525 · Pull Request #162 · dominion525/jetdb · GitHub
[go: up one dir, main page]

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,33 @@ jobs:
id: auth

# jetdb-cli depends on jetdb by version, so jetdb has to reach the
# registry first.
- run: cargo publish -p jetdb
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

- run: cargo publish -p jetdb-cli
# registry first. A crate whose version is on crates.io already is
# skipped, so that a re-run of this job, after jetdb-cli failed, publishes
# what is left.
- name: Publish the crates unless their versions are on crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
run: |
for crate in jetdb jetdb-cli; do
version="$(sed -n 's/^version = "\(.*\)"$/\1/p' "crates/$crate/Cargo.toml" | head -1)"
# crates.io answers 200 for a version it has, and 404 for a version,
# or a crate, it has not. It refuses a request with no User-Agent.
status="$(curl -sS -o /dev/null -w '%{http_code}' \
-A 'jetdb release workflow (https://github.com/dominion525/jetdb)' \
"https://crates.io/api/v1/crates/$crate/$version")" || status=failed
case "$status" in
200)
echo "$crate $version is on crates.io; not publishing"
;;
404)
cargo publish -p "$crate"
;;
*)
echo "::error::could not tell whether $crate $version is on crates.io (HTTP $status)"
exit 1
;;
esac
done

npm:
name: Publish (npm)
Expand Down
Loading
0