From 63f5bc8d02a983ecf7b3a785b233d5618e6a412c Mon Sep 17 00:00:00 2001 From: Jheison Martinez Bolivar Date: Tue, 7 Apr 2026 18:19:35 -0500 Subject: [PATCH 1/3] chore: update release action --- .github/workflows/release.yml | 52 +++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ebb7f74..168e869 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -154,9 +154,38 @@ jobs: - name: Approval granted run: echo "Release approved for publishing to crates.io" + ensure-owners: + name: Ensure crates.io owners + needs: create-tag + if: needs.create-tag.outputs.created == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ needs.create-tag.outputs.tag }} + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Add crates.io owners (best-effort) + env: + TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + OWNERS: github:univerlab:owners + run: | + set -eu + if [ -z "$TOKEN" ]; then + echo "No cargo token found in CARGO_REGISTRY_TOKEN; skipping owners update" + exit 0 + fi + CRATE_NAME=$(grep '^name = ' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/' | tr -d '\r') + echo "crate=$CRATE_NAME" + for owner in $(echo "$OWNERS" | tr ',' ' '); do + echo "Adding owner: $owner" + cargo owner --token "$TOKEN" --add "$owner" || echo "cargo owner failed for $owner (continuing)" + done + publish: name: Publish to crates.io - needs: [create-tag, approve] + needs: [create-tag, approve, ensure-owners] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -166,5 +195,24 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable + - name: Check if stable release + id: version_check + run: | + VERSION=$(grep '^version = ' Cargo.toml | sed 's/.*"\(.*\)".*/\1/') + if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "is_stable=true" >> $GITHUB_OUTPUT + echo "Version $VERSION is stable — will publish" + else + echo "is_stable=false" >> $GITHUB_OUTPUT + echo "Version $VERSION is prerelease/dev — skipping publish" + fi + - name: Cargo publish - run: cargo publish --token ${{ secrets.CARGO_TOKEN }} + if: steps.version_check.outputs.is_stable == 'true' + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: cargo publish --allow-dirty + + - name: Skipped prerelease + if: steps.version_check.outputs.is_stable == 'false' + run: echo "⏭️ Skipped crates.io publish for prerelease version" From ca72f47b241b70e64037aae84a34b4a0a45fa07e Mon Sep 17 00:00:00 2001 From: Jheison Martinez Bolivar Date: Wed, 8 Apr 2026 07:37:33 -0500 Subject: [PATCH 2/3] chore: align CI workflow with other projects --- .github/workflows/ci.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca01695..7fe01c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,12 +43,15 @@ jobs: - name: Cargo fmt run: cargo fmt --check - - name: Cargo clippy - run: cargo clippy --all-targets -- -D warnings + - name: Cargo build + run: cargo build --release - name: Cargo test run: cargo test + - name: Cargo clippy + run: cargo clippy --all-targets -- -D warnings + publish-check: name: Publish Check (dry-run) runs-on: ubuntu-latest @@ -64,6 +67,12 @@ jobs: path: ~/.cargo/registry key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v4 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cargo publish dry-run run: cargo publish --dry-run From 3361f6cc7b9859d24ff58698a8dce7f8df9476c5 Mon Sep 17 00:00:00 2001 From: Jheison Martinez Bolivar Date: Wed, 8 Apr 2026 07:43:54 -0500 Subject: [PATCH 3/3] feat: add manual trigger to release workflow --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 168e869..b82fcb5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,7 @@ on: - closed paths: - Cargo.toml + workflow_dispatch: permissions: contents: write