main
yml 70 lines 2.26 KB
Raw
1 name: Rust proto crate
2
3 on:
4 pull_request:
5 paths:
6 - "rust/proto/**"
7 - "rust/Cargo.toml"
8 - "rust/Cargo.lock"
9 - "rust-toolchain.toml"
10 - ".github/workflows/proto-crate.yml"
11 push:
12 tags:
13 - "proto-v*"
14 workflow_dispatch:
15
16 permissions:
17 contents: read
18
19 concurrency:
20 group: ${{ github.workflow }}-${{ github.ref }}
21 cancel-in-progress: ${{ github.event_name == 'pull_request' }}
22
23 jobs:
24 semver:
25 runs-on: ubuntu-latest
26 steps:
27 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
28 - uses: obi1kenobi/cargo-semver-checks-action@6b69fcf40e9b5fb17adeb57e4b6ecd020649a239 # v2
29 with:
30 manifest-path: rust/proto/Cargo.toml
31 package: vllm-proto
32
33 check:
34 runs-on: ubuntu-latest
35 steps:
36 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
37 - run: rustup show active-toolchain
38 - name: Check release version
39 if: github.event_name == 'push'
40 run: |
41 version=$(cargo metadata --manifest-path rust/Cargo.toml --no-deps --format-version 1 |
42 jq -er '.packages[] | select(.name == "vllm-proto") | .version')
43 if [[ "$GITHUB_REF_NAME" != "proto-v$version" ]]; then
44 echo "Tag $GITHUB_REF_NAME does not match vllm-proto version $version" >&2
45 exit 1
46 fi
47 - name: Verify package
48 run: cargo publish --manifest-path rust/proto/Cargo.toml --locked --dry-run
49
50 publish:
51 needs: [check, semver]
52 if: github.repository == 'vllm-project/vllm' && github.event_name == 'push'
53 runs-on: ubuntu-latest
54 environment: crates-io
55 permissions:
56 contents: read
57 id-token: write
58 steps:
59 - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
60 with:
61 ref: ${{ github.sha }}
62 - run: rustup show active-toolchain
63 - name: Verify package before authentication
64 run: cargo publish --manifest-path rust/proto/Cargo.toml --locked --dry-run
65 - uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
66 id: auth
67 - name: Publish
68 env:
69 CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
70 run: cargo publish --manifest-path rust/proto/Cargo.toml --locked