Skip to content

Commit 37dc9e3

Browse files
authored
Switch release workflow to single job. (#28)
Env vars are all now created dynamically from the first step.
1 parent 24632f3 commit 37dc9e3

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

.github/workflows/release.yaml

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create operator's container image for the new release
1+
name: Build and publish release containers to quay.io
22

33
on:
44
release:
@@ -9,50 +9,44 @@ on:
99
inputs:
1010
version:
1111
type: string
12-
description: 'SemVer for the new release.'
12+
description: 'Version (Semating Versioning) for the new release. E.g: 0.0.1'
1313
required: true
14-
default: 'v0.0.1'
14+
default: '0.0.1'
15+
1516
env:
1617
REGISTRY: quay.io
18+
REGISTRY_USER: testnetworkfunction
19+
REPO_BASE_NAME: cnf-certsuite-operator
20+
1721
TERM: xterm-color
1822

1923
jobs:
20-
set_release_version:
21-
name: Set release version.
24+
publish_new_version:
25+
name: Build and publish release containers to quay.io
2226
runs-on: ubuntu-22.04
2327
env:
2428
SHELL: /bin/bash
2529

26-
outputs:
27-
release_tag: ${{ steps.set_release.release_tag }}
28-
2930
steps:
3031
- name: Set release version output var depending on the trigger type.
3132
id: set_release
3233
run: |
33-
if ${GITHUB_EVENT_NAME} == "workflow_dispatch"; then
34+
if [ ${GITHUB_EVENT_NAME} == "workflow_dispatch" ]; then
3435
echo "Manually triggered workflow to make release ${{ inputs.version }}"
35-
echo "release_tag=${{ inputs.version }}" >> ${GITHUB_OUTPUT}
36+
VERSION=${{ inputs.version }}
37+
echo "VERSION=${VERSION}" >> ${GITHUB_ENV}
3638
else
3739
echo "New release published: ${{ github.ref_name }}"
38-
echo "release_tag=${{ github.ref_name }}" >> ${GITHUB_OUTPUT}
40+
echo "VERSION=${{ github.ref_name }}" >> ${GITHUB_ENV}
3941
fi
4042
41-
publish_new_version:
42-
needs: set_release_version
43-
name: Build and publish new version
44-
runs-on: ubuntu-22.04
45-
env:
46-
SHELL: /bin/bash
47-
VERSION: ${{ needs.set_release_version.outputs.release_tag }}
48-
USERNAME: testnetworkfunction
49-
REPO: ${REGISTRY}/${USERNAME}/cnf-certsuite-operator
50-
IMG: ${REPO}:v${VERSION}
51-
SIDECAR_IMG: ${REPO}-sidecar:v${VERSION}
52-
BUNDLE_IMG: ${REPO}-bundle:v${VERSION}
53-
CATALOG_IMG: ${REPO}-catalog:v${VERSION}
43+
REPO=${REGISTRY}/${REGISTRY_USER}/${REPO_BASE_NAME}
44+
45+
echo "IMG=${REPO}:v${VERSION}" >> ${GITHUB_ENV}
46+
echo "SIDECAR_IMG=${REPO}-sidecar:v${VERSION}" >> ${GITHUB_ENV}
47+
echo "BUNDLE_IMG=${REPO}-bundle:v${VERSION}" >> ${GITHUB_ENV}
48+
echo "CATALOG_IMG=${REPO}-catalog:v${VERSION}" >> ${GITHUB_ENV}
5449
55-
steps:
5650
- name: Print release images versions
5751
run: |
5852
echo "Release version to build: ${VERSION}"

0 commit comments

Comments
 (0)