update-on-release #154
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
name: "Update YugabyteDB version" | |
on: | |
repository_dispatch: | |
types: | |
- update-on-release | |
jobs: | |
update-version: | |
if: github.event.client_payload.prerelease == 'false' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Configure git" | |
run: | | |
git config user.name 'YugaByte CI' | |
git config user.email '[email protected]' | |
- name: "Extract version number from tag" | |
id: extract-version | |
run: | | |
tag_name="${{ github.event.client_payload.release }}" | |
echo "Extracting version number from the tag '${tag_name}'." | |
version_number="${tag_name/v/}" | |
# Keep dots and count the string length | |
dot_count="$(res="${version_number//[^.]/}"; echo "${#res}")" | |
if [[ "${dot_count}" -eq 2 ]]; then | |
version_number="${version_number}.0" | |
fi | |
if [[ "$(res="${version_number//[^.]/}"; echo "${#res}")" -ne 3 ]]; then | |
echo "The tag '${tag_name}' is invalid. Expected format: 'v1.2.3' or 'v1.2.3.5'." 1>&2 | |
exit 1 | |
fi | |
echo "Extracted the version number '${version_number}'." | |
echo "yb_version=${version_number}" >> "$GITHUB_ENV" | |
- name: "Print Python version and install dependencies" | |
run: | | |
python3 --version | |
pip3 install requests | |
- name: "Update the version" | |
id: update-version | |
run: | | |
.ci/update_version.sh "${yb_version}" | |
- name: "Push the changes" | |
run: | | |
git status | |
git diff | |
git add "pkg/controller/ybcluster/ybcluster_controller.go" \ | |
"deploy/crds/yugabyte.com_v1alpha1_ybcluster_full_cr.yaml" | |
git commit -m "Update the version to ${yb_version}" | |
git push origin ${{ github.ref }} | |
- name: "Show git status in case of failure" | |
if: failure() && steps.update-version.outcome == 'failure' | |
run: | | |
git status | |
git diff |