Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,23 +103,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

Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
Loading