@@ -344,10 +344,18 @@ jobs:
344
344
with:
345
345
crate: cargo-edit
346
346
bin: cargo-set-version
347
- - name: Update version if PR
348
- # For PRs to be merged against a release branch, the version has already been set, in which case ignore this step.
347
+ - name: Update version if PR against main branch
349
348
if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }}
350
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"
351
359
352
360
# Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the
353
361
# default value in the makefile if called from this action, but not otherwise (i.e. when called locally).
@@ -411,10 +419,18 @@ jobs:
411
419
with:
412
420
crate: cargo-edit
413
421
bin: cargo-set-version
414
- - name: Update version if PR
415
- # For PRs to be merged against a release branch, the version has already been set, in which case ignore this step.
422
+ - name: Update version if PR against main branch
416
423
if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }}
417
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"
418
434
- name: Build manifest list
419
435
run: |
420
436
# Creating manifest list
0 commit comments