@@ -344,10 +344,15 @@ 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
+ if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }}
352
+ run: |
353
+ MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
354
+ PR_VERSION="${MANIFEST_VERSION}-pr${{ github.event.pull_request.number }}"
355
+ cargo set-version --offline --workspace "$PR_VERSION"
351
356
352
357
# Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the
353
358
# default value in the makefile if called from this action, but not otherwise (i.e. when called locally).
@@ -411,10 +416,15 @@ jobs:
411
416
with:
412
417
crate: cargo-edit
413
418
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.
419
+ - name: Update version if PR against main branch
416
420
if: ${{ github.event_name == 'pull_request' && github.ref == 'refs/heads/main' }}
417
421
run: cargo set-version --offline --workspace 0.0.0-pr${{ github.event.pull_request.number }}
422
+ - name: Update version if PR against non-main branch
423
+ if: ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }}
424
+ run: |
425
+ MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
426
+ PR_VERSION="${MANIFEST_VERSION}-pr${{ github.event.pull_request.number }}"
427
+ cargo set-version --offline --workspace "$PR_VERSION"
418
428
- name: Build manifest list
419
429
run: |
420
430
# Creating manifest list
0 commit comments