|
1 | | -name: Publish Packages |
| 1 | +name: Release-plz |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | | - tags: |
5 | | - - "v*.*.*" |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
6 | 8 | jobs: |
7 | | - publish-rust: |
8 | | - runs-on: ubuntu-latest |
| 9 | + release-plz-release: |
| 10 | + name: Release-plz release |
9 | 11 | environment: release # Optional: for enhanced security |
| 12 | + runs-on: ubuntu-latest |
| 13 | + if: ${{ github.repository_owner == 'agentclientprotocol' }} |
10 | 14 | permissions: |
11 | | - contents: read |
12 | | - id-token: write # Required for OIDC token exchange |
| 15 | + contents: write |
| 16 | + id-token: write |
13 | 17 | steps: |
14 | | - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 |
15 | | - - name: Setup Rust |
16 | | - uses: actions-rust-lang/setup-rust-toolchain@1780873c7b576612439a134613cc4cc74ce5538c |
| 18 | + - &checkout |
| 19 | + name: Checkout repository |
| 20 | + uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 |
17 | 21 | with: |
18 | | - toolchain: nightly,stable |
19 | | - - name: Check semver |
20 | | - uses: obi1kenobi/cargo-semver-checks-action@5b298c9520f7096a4683c0bd981a7ac5a7e249ae |
21 | | - - uses: rust-lang/crates-io-auth-action@e919bc7605cde86df457cf5b93c5e103838bd879 |
22 | | - id: auth |
23 | | - - run: cargo publish -p agent-client-protocol |
| 22 | + fetch-depth: 0 |
| 23 | + persist-credentials: false |
| 24 | + - &install-rust |
| 25 | + name: Install Rust toolchain |
| 26 | + uses: dtolnay/rust-toolchain@0b1efabc08b657293548b77fb76cc02d26091c7e |
| 27 | + with: |
| 28 | + toolchain: stable |
| 29 | + - &generate-token |
| 30 | + # Generating a GitHub token, so that PRs and tags created by |
| 31 | + # the release-plz-action can trigger actions workflows. |
| 32 | + name: Generate GitHub token |
| 33 | + uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 |
| 34 | + id: generate-token |
| 35 | + with: |
| 36 | + # GitHub App ID secret name |
| 37 | + app-id: ${{ secrets.RELEASE_PLZ_APP_ID }} |
| 38 | + # GitHub App private key secret name |
| 39 | + private-key: ${{ secrets.RELEASE_PLZ_APP_PRIVATE_KEY }} |
| 40 | + - name: Run release-plz |
| 41 | + uses: release-plz/action@1efcf74dfcd6e500990dad806e286899ae384064 |
| 42 | + with: |
| 43 | + command: release |
24 | 44 | env: |
25 | | - CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }} |
| 45 | + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} |
26 | 46 |
|
27 | | - release: |
| 47 | + release-plz-pr: |
| 48 | + name: Release-plz PR |
28 | 49 | runs-on: ubuntu-latest |
29 | | - needs: [publish-rust] |
| 50 | + if: ${{ github.repository_owner == 'agentclientprotocol' }} |
30 | 51 | permissions: |
| 52 | + pull-requests: write |
31 | 53 | contents: write |
| 54 | + concurrency: |
| 55 | + group: release-plz-${{ github.ref }} |
| 56 | + cancel-in-progress: false |
32 | 57 | steps: |
33 | | - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 |
34 | | - - name: Create Release |
35 | | - id: create_release |
36 | | - uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090 |
| 58 | + - *checkout |
| 59 | + - *install-rust |
| 60 | + - *generate-token |
| 61 | + - name: Run release-plz |
| 62 | + uses: release-plz/action@1efcf74dfcd6e500990dad806e286899ae384064 |
37 | 63 | with: |
38 | | - draft: true |
| 64 | + command: release-pr |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} |
0 commit comments