Skip to content

Commit 137507d

Browse files
authored
chore(release): add next-1.y tags from commits on the release-** branches (RHIDP-8256) (#3186)
Signed-off-by: Nick Boldt <[email protected]>
1 parent 4056218 commit 137507d

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

.github/workflows/next-build-image.yaml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ on:
2727
tags:
2828
- '[0-9]+.[0-9]+.[0-9]+'
2929
- '[0-9]+.[0-9]+'
30+
branches:
31+
- 'release-**'
3032

3133
concurrency:
3234
group: ${{ github.workflow }}-${{ github.ref }}
@@ -71,12 +73,19 @@ jobs:
7173
ref_name=${{ github.ref_name }}
7274
if [ "$ref_name" == "main" ]; then
7375
ref_name="next"
76+
elif [[ "$ref_name" =~ ^release-([0-9]+)\.([0-9]+) ]]; then
77+
# next-1.y
78+
ref_name="next-${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
7479
fi
75-
# from 1.6.1 => 1.6
76-
ref_name_short="${ref_name%.*}"
77-
if [[ $ref_name_short == "1" ]]; then
78-
ref_name_short="${ref_name}"
80+
ref_name_short="${ref_name}"
81+
82+
# for releases only
83+
if [[ $ref_name != "next" ]] && [[ $ref_name != "next-"* ]]; then
84+
# shroten from 1.6.1 => 1.6
85+
ref_name_short="${ref_name%.*}"
86+
if [[ $ref_name_short == "1" ]]; then ref_name_short="${ref_name}"; fi
7987
fi
88+
8089
echo "REF_NAME=$ref_name" >> $GITHUB_ENV
8190
echo "REF_NAME_SHORT=${ref_name_short}" >> $GITHUB_ENV
8291
echo "PLATFORM=$platform" >> $GITHUB_ENV
@@ -89,7 +98,7 @@ jobs:
8998
- name: Build and Push with Buildx (for :next builds, 14d expiry)
9099
uses: ./.github/actions/docker-build
91100
id: build-next
92-
if: ${{ env.REF_NAME_SHORT == 'next' }}
101+
if: ${{ env.REF_NAME_SHORT == 'next' || env.REF_NAME_SHORT == 'next-'* }}
93102
with:
94103
registry: ${{ env.REGISTRY }}
95104
username: ${{ secrets.QUAY_USERNAME }}
@@ -105,7 +114,7 @@ jobs:
105114
- name: Build and Push with Buildx (for releases, 183d expiry)
106115
uses: ./.github/actions/docker-build
107116
id: build-release
108-
if: ${{ env.REF_NAME_SHORT != 'next' }}
117+
if: ${{ env.REF_NAME_SHORT != 'next' && env.REF_NAME_SHORT != 'next-'* }}
109118
with:
110119
registry: ${{ env.REGISTRY }}
111120
username: ${{ secrets.QUAY_USERNAME }}
@@ -120,15 +129,15 @@ jobs:
120129

121130
- name: Export digest (for :next builds)
122131
id: export-digest-next
123-
if: ${{ env.REF_NAME_SHORT == 'next' }}
132+
if: ${{ env.REF_NAME_SHORT == 'next' || env.REF_NAME_SHORT == 'next-'* }}
124133
run: |
125134
mkdir -p /tmp/digests
126135
digest="${{ steps.build-next.outputs.digest }}"
127136
touch "/tmp/digests/${digest#sha256:}"
128137
129138
- name: Export digest (for releases)
130139
id: export-digest-release
131-
if: ${{ env.REF_NAME_SHORT != 'next' }}
140+
if: ${{ env.REF_NAME_SHORT != 'next' && env.REF_NAME_SHORT != 'next-'* }}
132141
run: |
133142
mkdir -p /tmp/digests
134143
digest="${{ steps.build-release.outputs.digest }}"
@@ -181,7 +190,7 @@ jobs:
181190

182191
- name: Set container metadata (for :next builds, 14d expiry)
183192
id: meta-next
184-
if: ${{ env.REF_NAME_SHORT == 'next'}}
193+
if: ${{ env.REF_NAME_SHORT == 'next' || env.REF_NAME_SHORT == 'next-'* }}
185194
uses: docker/metadata-action@v5
186195
with:
187196
images: ${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }}
@@ -193,7 +202,7 @@ jobs:
193202
194203
- name: Set container metadata (for releases, 183d expiry)
195204
id: meta-release
196-
if: ${{ env.REF_NAME_SHORT != 'next' }}
205+
if: ${{ env.REF_NAME_SHORT != 'next' && env.REF_NAME_SHORT != 'next-'* }}
197206
uses: docker/metadata-action@v5
198207
with:
199208
images: ${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }}
@@ -220,12 +229,12 @@ jobs:
220229
221230
- name: Inspect image (for :next builds)
222231
id: inspect-next
223-
if: ${{ env.REF_NAME_SHORT == 'next'}}
232+
if: ${{ env.REF_NAME_SHORT == 'next' || env.REF_NAME_SHORT == 'next-'* }}
224233
run: |
225234
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }}:${{ steps.meta-next.outputs.version }}
226235
227236
- name: Inspect image (for releases)
228237
id: inspect-release
229-
if: ${{ env.REF_NAME_SHORT != 'next'}}
238+
if: ${{ env.REF_NAME_SHORT != 'next' && env.REF_NAME_SHORT != 'next-'* }}
230239
run: |
231240
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }}:${{ steps.meta-release.outputs.version }}

0 commit comments

Comments
 (0)