File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,20 +16,21 @@ jobs:
1616 version : ${{ steps.check.outputs.version }}
1717 steps :
1818 - uses : actions/checkout@v4
19- with :
20- fetch-depth : 2
2119
2220 - name : Detect version change
2321 id : check
2422 run : |
23+ CRATE_NAME=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].name')
2524 CURRENT=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
2625 echo "version=$CURRENT" >> "$GITHUB_OUTPUT"
27- if git diff HEAD~1 HEAD -- Cargo.toml | grep -q '+version'; then
26+ # Compare against crates.io instead of git history
27+ PUBLISHED=$(curl -s "https://crates.io/api/v1/crates/$CRATE_NAME" | jq -r '.crate.max_version // "0.0.0"')
28+ if [ "$PUBLISHED" = "null" ] || [ "$PUBLISHED" = "0.0.0" ] || [ "$CURRENT" != "$PUBLISHED" ]; then
2829 echo "changed=true" >> "$GITHUB_OUTPUT"
29- echo "Version changed to $CURRENT "
30+ echo "Local $CURRENT vs crates.io $PUBLISHED — publishing "
3031 else
3132 echo "changed=false" >> "$GITHUB_OUTPUT"
32- echo "Version unchanged ( $CURRENT) , skipping release "
33+ echo "Version $CURRENT already on crates.io , skipping"
3334 fi
3435
3536 publish :
You can’t perform that action at this time.
0 commit comments