@@ -354,13 +354,18 @@ jobs:
354
354
cargo set-version --offline --workspace "$PR_VERSION"
355
355
- name : Update version if PR against non-main branch
356
356
# For PRs to be merged against a release branch, use the version that has already been set in the calling script.
357
- if : ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-') }}
357
+ # We can't rely on cargo set-version here as we will break semver rules when changing the version to make it
358
+ # specific to this PR e.g. 1.2.0 --> 1.2.0-pr678, so set it manually.
359
+ if : ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }}
358
360
env :
359
361
PR_NUMBER : ${{ github.event.pull_request.number }}
362
+ shell : bash
360
363
run : |
364
+ set -euo pipefail
365
+
361
366
MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
362
367
PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}"
363
- cargo set- version --offline --workspace "$ PR_VERSION"
368
+ sed -i "s/ version = \"${MANIFEST_VERSION}\"/version = \"${ PR_VERSION}\"/" Cargo.toml
364
369
365
370
# Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the
366
371
# default value in the makefile if called from this action, but not otherwise (i.e. when called locally).
@@ -433,13 +438,18 @@ jobs:
433
438
cargo set-version --offline --workspace "$PR_VERSION"
434
439
- name : Update version if PR against non-main branch
435
440
# For PRs to be merged against a release branch, use the version that has already been set in the calling script.
436
- if : ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.base.ref, 'release-') }}
441
+ # We can't rely on cargo set-version here as we will break semver rules when changing the version to make it
442
+ # specific to this PR e.g. 1.2.0 --> 1.2.0-pr678, so set it manually.
443
+ if : ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }}
437
444
env :
438
445
PR_NUMBER : ${{ github.event.pull_request.number }}
446
+ shell : bash
439
447
run : |
448
+ set -euo pipefail
449
+
440
450
MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
441
451
PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}"
442
- cargo set- version --offline --workspace "$ PR_VERSION"
452
+ sed -i "s/ version = \"${MANIFEST_VERSION}\"/version = \"${ PR_VERSION}\"/" Cargo.toml
443
453
- name : Build manifest list
444
454
run : |
445
455
# Creating manifest list
0 commit comments