2626
2727 - name : Compute version number
2828 id : version-string
29- run : |
30- if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
31- # For main branch, use semver with -dev suffix
32- echo "tag=0.0.1-dev.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
33- elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
34- # For tags, use the tag as is (assuming it's semver)
35- TAG="${{ github.ref_name }}"
36- echo "tag=$TAG" >> "$GITHUB_OUTPUT"
37- else
38- # For other branches, use branch name and run number
39- BRANCH="${{ github.ref_name }}"
40- echo "tag=0.0.1-$BRANCH.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
41- fi
29+ uses : ./.github/actions/compute-version
4230
4331 - name : Login to GitHub Container Registry
4432 uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
6048 BUILD_DATE : ${{ github.event.head_commit.timestamp }}
6149 KO_CONFIG_PATH : ${{ github.workspace }}/.github/ko-ci.yml
6250 run : |
63- TAG=$(echo "$ {{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
51+ TAG=${{ steps.version-string.outputs.tag }}
6452 TAGS="-t $TAG"
6553
6654 # Add latest tag only if building from a tag
7563 # This step uses the identity token to provision an ephemeral certificate
7664 # against the sigstore community Fulcio instance.
7765 run : |
78- TAG=$(echo "$ {{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
66+ TAG=${{ steps.version-string.outputs.tag }}
7967 # Sign the ko image
8068 cosign sign -y $BASE_REPO:$TAG
8169
@@ -101,19 +89,7 @@ jobs:
10189
10290 - name : Compute version number
10391 id : version-string
104- run : |
105- if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
106- # For main branch, use semver with -dev suffix
107- echo "tag=0.0.1-dev.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
108- elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
109- # For tags, use the tag as is (assuming it's semver)
110- TAG="${{ github.ref_name }}"
111- echo "tag=$TAG" >> "$GITHUB_OUTPUT"
112- else
113- # For other branches, use branch name and run number
114- BRANCH="${{ github.ref_name }}"
115- echo "tag=0.0.1-$BRANCH.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
116- fi
92+ uses : ./.github/actions/compute-version
11793
11894 - name : Login to GitHub Container Registry
11995 uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
@@ -154,7 +130,7 @@ jobs:
154130 - name : Sign container image
155131 if : startsWith(github.ref, 'refs/tags/')
156132 run : |
157- TAG=$(echo "$ {{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
133+ TAG=${{ steps.version-string.outputs.tag }}
158134 cosign sign -y $BASE_REPO:$TAG
159135 cosign sign -y $BASE_REPO:latest
160136
@@ -189,19 +165,7 @@ jobs:
189165
190166 - name : Compute version number
191167 id : version-string
192- run : |
193- if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
194- # For main branch, use semver with -dev suffix
195- echo "tag=0.0.1-dev.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
196- elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
197- # For tags, use the tag as is (assuming it's semver)
198- TAG="${{ github.ref_name }}"
199- echo "tag=$TAG" >> "$GITHUB_OUTPUT"
200- else
201- # For other branches, use branch name and run number
202- BRANCH="${{ github.ref_name }}"
203- echo "tag=0.0.1-$BRANCH.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
204- fi
168+ uses : ./.github/actions/compute-version
205169
206170 - name : Login to GitHub Container Registry
207171 uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
@@ -238,7 +202,7 @@ jobs:
238202 BUILD_DATE : ${{ github.event.head_commit.timestamp }}
239203 KO_CONFIG_PATH : ${{ github.workspace }}/.github/ko-ci.yml
240204 run : |
241- TAG=$(echo "$ {{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
205+ TAG=${{ steps.version-string.outputs.tag }}
242206 TAGS="-t $TAG"
243207
244208 # Add latest tag only if building from a tag
@@ -258,8 +222,7 @@ jobs:
258222 tags : ${{ steps.ubi-meta.outputs.tags }}
259223 build-args : |
260224 CODEDIR=cmd/thv-operator
261- TAG=$(echo "${{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
262- VERSION=$TAG-ubi
225+ VERSION=${{ steps.version-string.outputs.tag }}-ubi
263226 COMMIT=${{ github.sha }}
264227 BUILD_DATE=${{ github.event.head_commit.timestamp }}
265228 labels : ${{ steps.ubi-meta.outputs.labels }}
@@ -268,8 +231,8 @@ jobs:
268231 # This step uses the identity token to provision an ephemeral certificate
269232 # against the sigstore community Fulcio instance.
270233 run : |
271- TAG=$(echo "$ {{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
272- UBI_TAG=$(echo "${{ steps.version-string.outputs.tag }}-ubi" | sed 's/+/_/g')
234+ TAG=${{ steps.version-string.outputs.tag }}
235+ UBI_TAG="${{ steps.version-string.outputs.tag }}-ubi"
273236 # Sign the ko image
274237 cosign sign -y $BASE_REPO:$TAG
275238 cosign sign -y $BASE_REPO:$UBI_TAG
@@ -301,19 +264,7 @@ jobs:
301264
302265 - name : Compute version number
303266 id : version-string
304- run : |
305- if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
306- # For main branch, use semver with -dev suffix
307- echo "tag=0.0.1-dev.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
308- elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
309- # For tags, use the tag as is (assuming it's semver)
310- TAG="${{ github.ref_name }}"
311- echo "tag=$TAG" >> "$GITHUB_OUTPUT"
312- else
313- # For other branches, use branch name and run number
314- BRANCH="${{ github.ref_name }}"
315- echo "tag=0.0.1-$BRANCH.$GITHUB_RUN_NUMBER+$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
316- fi
267+ uses : ./.github/actions/compute-version
317268
318269 - name : Login to GitHub Container Registry
319270 uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
@@ -350,7 +301,7 @@ jobs:
350301 BUILD_DATE : ${{ github.event.head_commit.timestamp }}
351302 KO_CONFIG_PATH : ${{ github.workspace }}/.github/ko-ci.yml
352303 run : |
353- TAG=$(echo "$ {{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
304+ TAG=${{ steps.version-string.outputs.tag }}
354305 TAGS="-t $TAG"
355306 # Add latest tag only if building from a tag
356307 if [[ "${{ github.ref }}" == refs/tags/* ]]; then
@@ -368,8 +319,7 @@ jobs:
368319 tags : ${{ steps.ubi-meta.outputs.tags }}
369320 build-args : |
370321 CODEDIR=cmd/thv-proxyrunner
371- TAG=$(echo "${{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
372- VERSION=$TAG-ubi
322+ VERSION=${{ steps.version-string.outputs.tag }}-ubi
373323 COMMIT=${{ github.sha }}
374324 BUILD_DATE=${{ github.event.head_commit.timestamp }}
375325 labels : ${{ steps.ubi-meta.outputs.labels }}
@@ -378,8 +328,8 @@ jobs:
378328 # This step uses the identity token to provision an ephemeral certificate
379329 # against the sigstore community Fulcio instance.
380330 run : |
381- TAG=$(echo "$ {{ steps.version-string.outputs.tag }}" | sed 's/+/_/g')
382- UBI_TAG=$(echo "${{ steps.version-string.outputs.tag }}-ubi" | sed 's/+/_/g')
331+ TAG=${{ steps.version-string.outputs.tag }}
332+ UBI_TAG="${{ steps.version-string.outputs.tag }}-ubi"
383333 # Sign the ko image
384334 cosign sign -y $BASE_REPO:$TAG
385335 cosign sign -y $BASE_REPO:$UBI_TAG
0 commit comments