Skip to content

Commit 3c492fb

Browse files
authored
Update release.yaml
1 parent 88432ee commit 3c492fb

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

.github/workflows/release.yaml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,36 @@ jobs:
1919
with:
2020
fetch-depth: 0
2121

22-
2322
- name: Configure Git
2423
run: |
2524
git config user.name "$GITHUB_ACTOR"
2625
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
2726
28-
- name: Install yq
29-
uses: mikefarah/yq@e4902167197fa3543d2c67667822642edbe2d630 # v4.41.1
30-
3127
- name: Override Chart Version
32-
id: override_version
3328
if: startsWith(github.ref, 'refs/heads/release/')
3429
run: |
3530
CHART_PATH="charts/konnector/Chart.yaml"
3631
37-
# 1. Get the base version from Chart.yaml
38-
BASE_VERSION=$(yq '.version' $CHART_PATH)
32+
# 1. Get the current base version safely
33+
# Assumes the version line is exactly "version: x.y.z"
34+
BASE_VERSION=$(grep '^version:' $CHART_PATH | cut -d ' ' -f 2 | tr -d '"')
3935
40-
# 2. Construct the pre-release version: <BASE_VERSION>-rc.<SHORT_SHA>
41-
# We use a short 7-character SHA for simplicity and uniqueness.
42-
SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-7)
43-
NEW_VERSION="${BASE_VERSION}-rc.${SHORT_SHA}"
36+
# 2. Construct the new pre-release version: <BASE_VERSION>-rc.<RUN_NUMBER>
37+
NEW_VERSION="${BASE_VERSION}-rc.${{ github.run_number }}"
4438
45-
echo "Original Chart Version: $BASE_VERSION"
39+
echo "Original: $BASE_VERSION"
4640
echo "New Pre-release Version: $NEW_VERSION"
4741
48-
# 3. Update the version in Chart.yaml using yq
49-
yq -i ".version = \"$NEW_VERSION\"" $CHART_PATH
42+
# 3. Update the version in Chart.yaml using sed
43+
# The -i flag modifies the file in place.
44+
sed -i[gG] "s/^version: .*/version: \"$NEW_VERSION\"/" $CHART_PATH
45+
46+
# 4. Remove the temporary backup file created by sed (if any)
47+
find . -type f -name '*[gG]' -delete
5048
51-
echo "--- Updated Chart.yaml ---"
49+
echo "Updated $CHART_PATH"
5250
cat $CHART_PATH
53-
echo "--------------------------"
51+
shell: bash
5452

5553
- name: Install Helm
5654
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5

0 commit comments

Comments
 (0)