Skip to content

Commit

Permalink
conditionalize cargo publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Evanczuk committed Jun 2, 2023
1 parent d8d62eb commit ffdf752
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cargo publish
run: |
cargo publish
published_version=$(cargo pkgid -p pks | awk -F "#" '{print $2}')
package_version="pks@$(awk -F '"' '/^name/ {pkg = $2} /^version/ && pkg == "pks" {print $2}' Cargo.toml)"
if [[ "$published_version" == "$package_version" ]]; then
echo "Package 'pks' version $package_version has already been published."
else
cargo publish
fi
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

0 comments on commit ffdf752

Please sign in to comment.