v0.3.4 #11
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: crates-io | |
| url: https://crates.io/crates/soothe-client | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Read version | |
| id: version | |
| run: | | |
| VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1) | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Package version: $VERSION" | |
| - name: Check if version exists on crates.io | |
| id: check | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| PKG="soothe-client" | |
| echo "Checking if ${PKG}@${VERSION} exists on crates.io..." | |
| if curl -sf "https://crates.io/api/v1/crates/${PKG}/${VERSION}" >/dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| echo "Version ${VERSION} already exists, skipping publish" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| echo "Version ${VERSION} not found, will publish" | |
| fi | |
| - name: Verify | |
| if: steps.check.outputs.exists == 'false' | |
| run: | | |
| cargo fmt --check | |
| cargo clippy --all-targets --features image -- -D warnings | |
| cargo test --lib --test unit_api --test appkit_unit --features image | |
| cargo build --release --features image | |
| - name: Publish to crates.io | |
| if: steps.check.outputs.exists == 'false' | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| run: cargo publish |