diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 148289b..ef00227 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -75,8 +75,6 @@ jobs: build-container-image: name: Build/Publish ${{ matrix.runner.arch }} Image - needs: - - cargo-udeps permissions: id-token: write strategy: @@ -103,23 +101,33 @@ jobs: - name: Update/Extract Operator Version id: version - if: github.event_name == 'pull_request' env: PR_BASE_REF: ${{ github.event.pull_request.base.ref }} PR_NUMBER: ${{ github.event.pull_request.number }} + GITHUB_EVENT_NAME: ${{ github.event_name }} GITHUB_DEBUG: ${{ runner.debug }} shell: bash run: | set -euo pipefail [ -n "$GITHUB_DEBUG" ] && set -x + CURRENT_VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') - if [ "$PR_BASE_REF" == 'main' ]; then - NEW_VERSION="0.0.0-pr$PR_NUMBER" + + if [ "$GITHUB_EVENT_NAME" == 'pull_request' ]; then + # Include a PR suffix if this workflow is triggered by a PR + if [ "$PR_BASE_REF" == 'main' ]; then + NEW_VERSION="0.0.0-pr$PR_NUMBER" + else + NEW_VERSION="$CURRENT_VERSION-pr$PR_NUMBER" + fi else - NEW_VERSION="$CURRENT_VERSION-pr$PR_NUMBER" + # Just use the current version if this workflow is run on push, schedule, etc... + NEW_VERSION="$CURRENT_VERSION" fi + sed -i "s/version = \"${CURRENT_VERSION}\"/version = \"${NEW_VERSION}\"/" Cargo.toml echo "OPERATOR_VERSION=$NEW_VERSION" | tee -a "$GITHUB_OUTPUT" + - name: Install Nix uses: cachix/install-nix-action@fc6e360bedc9ee72d75e701397f0bb30dce77568 # v31.5.2 @@ -213,6 +221,21 @@ jobs: image-index-uri: oci.stackable.tech/sdp/${{ env.OPERATOR_NAME }}:${{ needs.build-container-image.outputs.operator-version }} image-architecture: ${{ matrix.arch }} + # This job is a required check in GitHub Settings for this repository. + # It saves us having to list many required jobs, or work around dynamically + # named jobs (since there is no concept of required settings). + finished: + # WARNING: Do not change the name unless you will also be changing the + # Required Checks (in branch protections) in GitHub settings. + name: Finished Build and Publish + needs: + - cargo-udeps + - openshift-preflight-check + - publish-helm-chart + runs-on: ubuntu-latest + steps: + - run: echo "We are done here" + notify: name: Failure Notification needs: diff --git a/renovate.json b/renovate.json index 2e0c612..7af8ce9 100644 --- a/renovate.json +++ b/renovate.json @@ -3,5 +3,5 @@ "extends": [ "local>stackabletech/.github:renovate-config" ], - "ignorePaths": [".github/workflows/build.yaml", ".github/workflows/build.yml", ".github/workflows/general_daily_security.yml", ".github/workflows/integration-test.yml", ".github/workflows/pr_pre-commit.yaml"] + "ignorePaths": [".github/workflows/build.yaml", ".github/workflows/general_daily_security.yml", ".github/workflows/integration-test.yml", ".github/workflows/pr_pre-commit.yaml"] }