Skip to content

Commit

Permalink
Add github action step to publish lib crate if not already published
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyGolden committed Jul 12, 2024
1 parent 633eacf commit 5829996
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/publish-crate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@ jobs:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Publish to crates.io
- name: Publish lib to crates.io if it is not published
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: |
crate_name="tinted-builder"
version="$(cargo read-manifest --manifest-path ./tinted-builder/Cargo.toml | jq -r ".version")"
response=$(curl -s "https://crates.io/api/v1/crates/$crate_name")
if ! echo "$response" | grep -q "\"num\":\"$version\""; then
cargo publish -p tinted-builder --locked
fi
- name: Publish cli to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: cargo publish -p tinted-builder-rust --locked

0 comments on commit 5829996

Please sign in to comment.