7575
7676 build-container-image :
7777 name : Build/Publish ${{ matrix.runner.arch }} Image
78- needs :
79- - cargo-udeps
8078 permissions :
8179 id-token : write
8280 strategy :
@@ -103,23 +101,33 @@ jobs:
103101
104102 - name : Update/Extract Operator Version
105103 id : version
106- if : github.event_name == 'pull_request'
107104 env :
108105 PR_BASE_REF : ${{ github.event.pull_request.base.ref }}
109106 PR_NUMBER : ${{ github.event.pull_request.number }}
107+ GITHUB_EVENT_NAME : ${{ github.event_name }}
110108 GITHUB_DEBUG : ${{ runner.debug }}
111109 shell : bash
112110 run : |
113111 set -euo pipefail
114112 [ -n "$GITHUB_DEBUG" ] && set -x
113+
115114 CURRENT_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version')
116- if [ "$PR_BASE_REF" == 'main' ]; then
117- NEW_VERSION="0.0.0-pr$PR_NUMBER"
115+
116+ if [ "$GITHUB_EVENT_NAME" == 'pull_request' ]; then
117+ # Include a PR suffix if this workflow is triggered by a PR
118+ if [ "$PR_BASE_REF" == 'main' ]; then
119+ NEW_VERSION="0.0.0-pr$PR_NUMBER"
120+ else
121+ NEW_VERSION="$CURRENT_VERSION-pr$PR_NUMBER"
122+ fi
118123 else
119- NEW_VERSION="$CURRENT_VERSION-pr$PR_NUMBER"
124+ # Just use the current version if this workflow is run on push, schedule, etc...
125+ NEW_VERSION="$CURRENT_VERSION"
120126 fi
127+
121128 sed -i "s/version = \"${CURRENT_VERSION}\"/version = \"${NEW_VERSION}\"/" Cargo.toml
122129 echo "OPERATOR_VERSION=$NEW_VERSION" | tee -a "$GITHUB_OUTPUT"
130+
123131 - name : Install Nix
124132 uses : cachix/install-nix-action@fc6e360bedc9ee72d75e701397f0bb30dce77568 # v31.5.2
125133
@@ -213,6 +221,21 @@ jobs:
213221 image-index-uri : oci.stackable.tech/sdp/${{ env.OPERATOR_NAME }}:${{ needs.build-container-image.outputs.operator-version }}
214222 image-architecture : ${{ matrix.arch }}
215223
224+ # This job is a required check in GitHub Settings for this repository.
225+ # It saves us having to list many required jobs, or work around dynamically
226+ # named jobs (since there is no concept of required settings).
227+ finished :
228+ # WARNING: Do not change the name unless you will also be changing the
229+ # Required Checks (in branch protections) in GitHub settings.
230+ name : Finished Build and Publish
231+ needs :
232+ - cargo-udeps
233+ - openshift-preflight-check
234+ - publish-helm-chart
235+ runs-on : ubuntu-latest
236+ steps :
237+ - run : echo "We are done here"
238+
216239 notify :
217240 name : Failure Notification
218241 needs :
0 commit comments