Crates Publish #31
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: Crates Publish | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| description: "Optional git tag or commit SHA to publish from" | |
| type: string | |
| required: false | |
| exclude_crates: | |
| description: "Optional comma-separated list of crates to exclude (e.g., 'sift_error,sift_connect')" | |
| type: string | |
| required: false | |
| jobs: | |
| rust-ci: | |
| uses: ./.github/workflows/rust_ci.yaml | |
| with: | |
| ref: ${{ github.event.inputs.ref }} | |
| publish-to-crates-io: | |
| runs-on: ubuntu-latest | |
| name: Publish to crates.io for the sift rust libraries | |
| needs: rust-ci | |
| environment: | |
| name: crates.io | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.inputs.ref || github.sha }} | |
| - name: Install stable toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build exclude flags | |
| id: excludes | |
| run: | | |
| EXCLUDE_FLAGS="--exclude sift-stream-bindings --exclude sift_cli" | |
| if [ -n "${{ inputs.exclude_crates }}" ]; then | |
| IFS=',' read -ra CRATES <<< "${{ inputs.exclude_crates }}" | |
| for crate in "${CRATES[@]}"; do | |
| crate=$(echo "$crate" | xargs) | |
| if [ -n "$crate" ]; then | |
| EXCLUDE_FLAGS="$EXCLUDE_FLAGS --exclude $crate" | |
| fi | |
| done | |
| fi | |
| echo "flags=$EXCLUDE_FLAGS" >> $GITHUB_OUTPUT | |
| - name: Publish crates | |
| run: cargo publish --workspace ${{ steps.excludes.outputs.flags }} --manifest-path ./Cargo.toml --locked --token ${CARGO_REGISTRY_TOKEN} | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |