v0.1.207 #4
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: Publish to crates.io | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Dry run (do not publish)' | |
| required: false | |
| default: 'false' | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| publish: | |
| name: Publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-publish-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-publish- | |
| - name: Verify version matches tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| TAG_VERSION=${GITHUB_REF#refs/tags/v} | |
| CARGO_VERSION=$(grep '^\s*version\s*=' Cargo.toml | head -n 1 | sed 's/.*"\(.*\)"/\1/') | |
| if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then | |
| echo "Version mismatch: tag=$TAG_VERSION, Cargo.toml=$CARGO_VERSION" | |
| exit 1 | |
| fi | |
| echo "Version verified: $TAG_VERSION" | |
| - name: Run tests before publish | |
| run: cargo test --workspace --all-features | |
| - name: Build release | |
| run: cargo build --workspace --release | |
| # Publish crates in dependency order | |
| - name: Publish rustapi-core | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p rustapi-core --token ${{ secrets.CRATES_IO_TOKEN }} | |
| continue-on-error: true | |
| - name: Wait for crates.io index update | |
| if: github.event.inputs.dry_run != 'true' | |
| run: sleep 30 | |
| - name: Publish rustapi-macros | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p rustapi-macros --token ${{ secrets.CRATES_IO_TOKEN }} | |
| continue-on-error: true | |
| - name: Wait for crates.io index update | |
| if: github.event.inputs.dry_run != 'true' | |
| run: sleep 30 | |
| - name: Publish rustapi-validate | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p rustapi-validate --token ${{ secrets.CRATES_IO_TOKEN }} | |
| continue-on-error: true | |
| - name: Wait for crates.io index update | |
| if: github.event.inputs.dry_run != 'true' | |
| run: sleep 30 | |
| - name: Publish rustapi-openapi | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p rustapi-openapi --token ${{ secrets.CRATES_IO_TOKEN }} | |
| continue-on-error: true | |
| - name: Wait for crates.io index update | |
| if: github.event.inputs.dry_run != 'true' | |
| run: sleep 30 | |
| - name: Publish rustapi-extras | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p rustapi-extras --token ${{ secrets.CRATES_IO_TOKEN }} | |
| continue-on-error: true | |
| - name: Wait for crates.io index update | |
| if: github.event.inputs.dry_run != 'true' | |
| run: sleep 30 | |
| - name: Publish rustapi-toon | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p rustapi-toon --token ${{ secrets.CRATES_IO_TOKEN }} | |
| continue-on-error: true | |
| - name: Wait for crates.io index update | |
| if: github.event.inputs.dry_run != 'true' | |
| run: sleep 30 | |
| - name: Publish rustapi-view | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p rustapi-view --token ${{ secrets.CRATES_IO_TOKEN }} | |
| continue-on-error: true | |
| - name: Wait for crates.io index update | |
| if: github.event.inputs.dry_run != 'true' | |
| run: sleep 30 | |
| - name: Publish rustapi-ws | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p rustapi-ws --token ${{ secrets.CRATES_IO_TOKEN }} | |
| continue-on-error: true | |
| - name: Wait for crates.io index update | |
| if: github.event.inputs.dry_run != 'true' | |
| run: sleep 30 | |
| - name: Publish rustapi-rs (main crate) | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p rustapi-rs --token ${{ secrets.CRATES_IO_TOKEN }} | |
| - name: Publish cargo-rustapi | |
| if: github.event.inputs.dry_run != 'true' | |
| run: cargo publish -p cargo-rustapi --token ${{ secrets.CRATES_IO_TOKEN }} | |
| continue-on-error: true | |
| - name: Dry run verification | |
| if: github.event.inputs.dry_run == 'true' | |
| run: | | |
| echo "Dry run mode - verifying packages can be published..." | |
| cargo publish -p rustapi-core --dry-run | |
| cargo publish -p rustapi-macros --dry-run | |
| cargo publish -p rustapi-validate --dry-run | |
| cargo publish -p rustapi-openapi --dry-run | |
| cargo publish -p rustapi-extras --dry-run | |
| cargo publish -p rustapi-toon --dry-run | |
| cargo publish -p rustapi-view --dry-run | |
| cargo publish -p rustapi-ws --dry-run | |
| cargo publish -p rustapi-rs --dry-run | |
| cargo publish -p cargo-rustapi --dry-run | |
| echo "All packages verified successfully!" |