CTTY commented on code in PR #3185:
URL: https://github.com/apache/iceberg-rust/pull/3185#discussion_r3993893994


##########
.github/workflows/ci.yml:
##########
@@ -78,6 +78,22 @@ jobs:
       - name: Check crates package LICENSE and NOTICE
         run: make check-license-notice
 
+      # Trusted publishing cannot create a crate 
(https://crates.io/docs/trusted-publishing),
+      # so a new publishable crate must be reserved on crates.io before it is 
merged.
+      # See "Adding a new crate" in website/src/release.md.
+      - name: Check publishable crates exist on crates.io
+        run: |
+          pkgs=$(cargo metadata --no-deps --format-version=1 | jq -r 
'.packages[] | select(.publish != []) | .name')
+          # A failed `cargo metadata` would otherwise leave the loop empty and 
the step green.
+          [ -n "$pkgs" ] || { echo "::error::No publishable crates found in 
the workspace, expected at least one"; exit 1; }
+          for pkg in $pkgs; do
+            # --registry is required, otherwise cargo resolves the local 
workspace member.
+            if ! cargo info --registry crates-io "$pkg" >/dev/null; then
+              echo "::error::$pkg is not on crates.io. Reserve it before 
merging; see 'Adding a new crate' in website/src/release.md"
+              exit 1
+            fi
+          done

Review Comment:
   One loophole is people can snipe the crate name before us, making the CI 
green but we eventually won't be able to publish the crates. But I think the 
impact of that would be okay, and I have faith in the goodness of people :D
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to