chore(pq-key-encoder): bump rust version to 1.0.1 #8
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: | |
| push: | |
| tags: | |
| - '*/rust@*' | |
| jobs: | |
| parse-tag: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| package: ${{ steps.tag.outputs.package }} | |
| version: ${{ steps.tag.outputs.version }} | |
| steps: | |
| - name: Parse tag | |
| id: tag | |
| run: | | |
| # Tag format: pq-oid/rust@1.0.0 | |
| TAG="${GITHUB_REF_NAME}" | |
| PACKAGE="${TAG%%/rust@*}" # pq-oid | |
| VERSION="${TAG##*/rust@}" # 1.0.0 | |
| echo "package=$PACKAGE" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Publishing $PACKAGE version $VERSION to crates.io" | |
| test: | |
| needs: parse-tag | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| toolchain: [stable, beta, '1.78'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust ${{ matrix.toolchain }} | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: ${{ matrix.toolchain }} | |
| components: rustfmt, clippy | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/ | |
| ~/.cargo/git/ | |
| target/ | |
| key: cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ needs.parse-tag.outputs.package }}-${{ hashFiles(format('packages/{0}/rust/Cargo.toml', needs.parse-tag.outputs.package)) }} | |
| restore-keys: | | |
| cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ needs.parse-tag.outputs.package }}- | |
| cargo-${{ runner.os }}-${{ matrix.toolchain }}- | |
| - name: Check formatting | |
| working-directory: packages/${{ needs.parse-tag.outputs.package }}/rust | |
| run: cargo fmt -- --check | |
| - name: Clippy | |
| working-directory: packages/${{ needs.parse-tag.outputs.package }}/rust | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Build | |
| working-directory: packages/${{ needs.parse-tag.outputs.package }}/rust | |
| run: cargo build --all-targets | |
| - name: Test | |
| working-directory: packages/${{ needs.parse-tag.outputs.package }}/rust | |
| run: cargo test | |
| publish: | |
| needs: [parse-tag, test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/ | |
| ~/.cargo/git/ | |
| target/ | |
| key: cargo-publish-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| cargo-publish- | |
| - name: Verify version matches | |
| run: | | |
| CARGO_VERSION=$(grep '^version' packages/${{ needs.parse-tag.outputs.package }}/rust/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/') | |
| if [ "$CARGO_VERSION" != "${{ needs.parse-tag.outputs.version }}" ]; then | |
| echo "::error::Tag version (${{ needs.parse-tag.outputs.version }}) doesn't match Cargo.toml ($CARGO_VERSION)" | |
| exit 1 | |
| fi | |
| echo "Version verified: $CARGO_VERSION" | |
| - name: Publish | |
| working-directory: packages/${{ needs.parse-tag.outputs.package }}/rust | |
| run: cargo publish | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} |