-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
US-393502 : pega-helm-chart version in repo should match build versio…
…ns (#699) Chart version sync
- Loading branch information
1 parent
36e377b
commit 4b46c50
Showing
4 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
set -e | ||
tagVersion="" | ||
if [ ${GITHUB_REF_TYPE} == "tag" ] | ||
then | ||
tagVersion=${GITHUB_REF_NAME} | ||
fi | ||
export CHART_VERSION=$(expr ${tagVersion:1}) | ||
|
||
echo "${GITHUB_REF}" | ||
echo "${GITHUB_REPOSITORY}" | ||
echo "${GITHUB_ACTOR}" | ||
|
||
repo_uri="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | ||
remote_name="origin" | ||
target_branch="master" | ||
tmp_build_dir="/tmp/build_dir" | ||
|
||
cd "$GITHUB_WORKSPACE" | ||
|
||
git config --global user.name "$GITHUB_ACTOR" | ||
git config --global user.email "${GITHUB_ACTOR}@bots.github.com" | ||
|
||
echo "Creating a temporary directory to build" | ||
mkdir -p "$tmp_build_dir" | ||
|
||
echo "clone a single branch master" | ||
git clone --quiet --branch="$target_branch" --depth=1 "$repo_uri" "$tmp_build_dir" > /dev/null | ||
|
||
cd "$tmp_build_dir" | ||
|
||
# Update version in charts/pega/Chart.yaml | ||
awk -v new_version="${CHART_VERSION}" '/^version:/ {$2="\"" new_version "\""}1' charts/pega/Chart.yaml > temp && mv temp charts/pega/Chart.yaml | ||
# Update version in charts/addons/Chart.yaml | ||
awk -v new_version="${CHART_VERSION}" '/^version:/ {$2="\"" new_version "\""}1' charts/addons/Chart.yaml > temp && mv temp charts/addons/Chart.yaml | ||
# Update version in charts/backingservices/Chart.yaml | ||
awk -v new_version="${CHART_VERSION}" '/^version:/ {$2="\"" new_version "\""}1' charts/backingservices/Chart.yaml > temp && mv temp charts/backingservices/Chart.yaml | ||
|
||
# Commit changes | ||
git add charts/pega/Chart.yaml charts/addons/Chart.yaml charts/backingservices/Chart.yaml | ||
|
||
echo "Updating chart versions to ${CHART_VERSION}" | ||
git commit -m "Update chart versions to ${CHART_VERSION}" | ||
|
||
echo "Pushing to master" | ||
git push -q "$remote_name" "$target_branch" > /dev/null |