Skip to content

Commit 6143f69

Browse files
committed
applied workflow changes for RCs
1 parent 0dd23ab commit 6143f69

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
- trying
1414
- "renovate/**"
1515
tags:
16-
- '[0-9][0-9].[0-9]+.[0-9]+'
16+
- '[0-9][0-9].[0-9]+.[0-9]+(-rc[0-9]+)?'
1717
pull_request:
1818
merge_group:
1919
schedule:
@@ -344,9 +344,18 @@ jobs:
344344
with:
345345
crate: cargo-edit
346346
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' }}
349349
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"
350359
351360
# Recreate charts and publish charts and docker image. The "-e" is needed as we want to override the
352361
# default value in the makefile if called from this action, but not otherwise (i.e. when called locally).
@@ -410,9 +419,18 @@ jobs:
410419
with:
411420
crate: cargo-edit
412421
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' }}
415424
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"
416434
- name: Build manifest list
417435
run: |
418436
# Creating manifest list

0 commit comments

Comments
 (0)