Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit fc0dde5

Browse files
Merge pull request #1205 from pmem/stable-1.12
Merge stable-1.12 into stable-1.13
2 parents c7d66b7 + 5401d48 commit fc0dde5

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

.github/workflows/gha.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- name: Get release version
4343
if: github.event_name == 'release'
4444
id: get_release_version
45-
run: echo ::set-output name=VERSION::$(echo ${{ github.event.release.tag_name }} | grep -E "^[0-9]+.[0-9]+(-rc[0-9]+)?$" | cut -f 1,2 -d . | cut -f 1 -d -)
45+
run: echo ::set-output name=VERSION::$(echo ${{ github.event.release.tag_name }} | awk -F '[.-]' '/^[0-9]+.[0-9]+[.0-9]*(-rc[0-9]+)?$/ {print $1 "." $2}')
4646

4747
- name: Set image version and force image action for release
4848
if: github.event_name == 'release' && steps.get_release_version.outputs.VERSION != ''
@@ -51,9 +51,16 @@ jobs:
5151
echo "FORCE_IMAGE_ACTION=rebuild" >> $GITHUB_ENV
5252
5353
- name: Set image version and force image action for stable branch
54-
if: startsWith(github.ref, 'refs/heads/stable-')
54+
# we want to set IMG_VER to e.g. '1.x' for stable branches and PRs against them
55+
# for PRs we have to use 'base_ref' - this is the target branch (and we have to check that instead)
56+
if:
57+
startsWith(github.ref, 'refs/heads/stable-') || startsWith(github.base_ref, 'stable-')
58+
# we now know we're on (or against) stable branches, so we just need to pick the version (e.g. the mentioned '1.x')
5559
run: |
56-
echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV
60+
IMG_VER=$(echo ${GITHUB_BASE_REF} | cut -d - -f 2)
61+
[ -z "${IMG_VER}" ] \
62+
&& echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV \
63+
|| echo "IMG_VER=${IMG_VER}" >> $GITHUB_ENV
5764
echo "FORCE_IMAGE_ACTION=rebuild" >> $GITHUB_ENV
5865
5966
- name: Clone the git repo
@@ -67,6 +74,7 @@ jobs:
6774

6875
- name: Run the build
6976
run: cd $WORKDIR && ${{ matrix.CONFIG }} ./build.sh
77+
7078
doc:
7179
name: build and publish docs
7280
runs-on: ubuntu-latest
@@ -82,6 +90,12 @@ jobs:
8290
matrix:
8391
CONFIG: ["TYPE=doc OS=fedora OS_VER=32"]
8492
steps:
93+
- name: Set image version for stable branch
94+
# doc update happens only on stable branch (not on PR), so we check only for heads ref
95+
if: startsWith(github.ref, 'refs/heads/stable-')
96+
run: |
97+
echo "IMG_VER=$(echo ${GITHUB_REF#refs/heads/} | cut -d - -f 2)" >> $GITHUB_ENV
98+
8599
- name: Clone the git repo
86100
uses: actions/checkout@v2
87101
with:

0 commit comments

Comments
 (0)