@@ -350,13 +350,15 @@ jobs:
350
350
run : cargo set-version --offline --workspace 0.0.0-pr${{ github.event.pull_request.number }}
351
351
- name : Update version if PR against non-main branch
352
352
# For PRs to be merged against a release branch, use the version that has already been set in the calling script.
353
+ # We can't rely on cargo set-version here as we will break semver rules when changing the version to make it
354
+ # specific to this PR e.g. 1.2.0 --> 1.2.0-pr678, so set it manually.
353
355
if : ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }}
354
356
env :
355
357
PR_NUMBER : ${{ github.event.pull_request.number }}
356
358
run : |
357
359
MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
358
360
PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}"
359
- cargo set- version --offline --workspace "$ PR_VERSION"
361
+ sed -i "s/ version = \"${MANIFEST_VERSION}\"/version = \"${ PR_VERSION}\"/" Cargo.toml
360
362
361
363
# Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the
362
364
# default value in the makefile if called from this action, but not otherwise (i.e. when called locally).
@@ -425,13 +427,15 @@ jobs:
425
427
run : cargo set-version --offline --workspace 0.0.0-pr${{ github.event.pull_request.number }}
426
428
- name : Update version if PR against non-main branch
427
429
# For PRs to be merged against a release branch, use the version that has already been set in the calling script.
430
+ # We can't rely on cargo set-version here as we will break semver rules when changing the version to make it
431
+ # specific to this PR e.g. 1.2.0 --> 1.2.0-pr678, so set it manually.
428
432
if : ${{ github.event_name == 'pull_request' && github.ref != 'refs/heads/main' }}
429
433
env :
430
434
PR_NUMBER : ${{ github.event.pull_request.number }}
431
435
run : |
432
436
MANIFEST_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
433
437
PR_VERSION="${MANIFEST_VERSION}-pr${PR_NUMBER}"
434
- cargo set- version --offline --workspace "$ PR_VERSION"
438
+ sed -i "s/ version = \"${MANIFEST_VERSION}\"/version = \"${ PR_VERSION}\"/" Cargo.toml
435
439
- name : Build manifest list
436
440
run : |
437
441
# Creating manifest list
0 commit comments