|
13 | 13 | - trying |
14 | 14 | - "renovate/**" |
15 | 15 | tags: |
16 | | - - '[0-9][0-9].[0-9]+.[0-9]+' |
| 16 | + - '[0-9][0-9].[0-9]+.[0-9]+(-rc[0-9]+)?' |
17 | 17 | pull_request: |
18 | 18 | merge_group: |
19 | 19 | schedule: |
@@ -344,9 +344,18 @@ jobs: |
344 | 344 | with: |
345 | 345 | crate: cargo-edit |
346 | 346 | bin: cargo-set-version |
347 | | - - name: Update version if PR |
348 | | - if: ${{ github.event_name == 'pull_request' }} |
| 347 | + - name: Update version if PR against main branch |
| 348 | + if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }} |
349 | 349 | run: cargo set-version --offline --workspace 0.0.0-pr${{ github.event.pull_request.number }} |
| 350 | + - name: Update version if PR against non-main branch |
| 351 | + # For PRs to be merged against a release branch, use the version that has already been set in the calling script. |
| 352 | + if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }} |
| 353 | + env: |
| 354 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 355 | + run: | |
| 356 | + MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') |
| 357 | + PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}" |
| 358 | + cargo set-version --offline --workspace "$PR_VERSION" |
350 | 359 |
|
351 | 360 | # Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the |
352 | 361 | # default value in the makefile if called from this action, but not otherwise (i.e. when called locally). |
@@ -410,9 +419,18 @@ jobs: |
410 | 419 | with: |
411 | 420 | crate: cargo-edit |
412 | 421 | bin: cargo-set-version |
413 | | - - name: Update version if PR |
414 | | - if: ${{ github.event_name == 'pull_request' }} |
| 422 | + - name: Update version if PR against main branch |
| 423 | + if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }} |
415 | 424 | run: cargo set-version --offline --workspace 0.0.0-pr${{ github.event.pull_request.number }} |
| 425 | + - name: Update version if PR against non-main branch |
| 426 | + # For PRs to be merged against a release branch, use the version that has already been set in the calling script. |
| 427 | + if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }} |
| 428 | + env: |
| 429 | + PR_NUMBER: ${{ github.event.pull_request.number }} |
| 430 | + run: | |
| 431 | + MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') |
| 432 | + PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}" |
| 433 | + cargo set-version --offline --workspace "$PR_VERSION" |
416 | 434 | - name: Build manifest list |
417 | 435 | run: | |
418 | 436 | # Creating manifest list |
|
0 commit comments