-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: automate PR for sdk version bump (#1137)
- Loading branch information
Showing
4 changed files
with
102 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ version: 2.1 | |
|
||
orbs: | ||
build-tools: circleci/[email protected] | ||
github-cli: circleci/[email protected] | ||
|
||
commands: | ||
checkout-and-merge-to-main: | ||
|
@@ -216,6 +217,31 @@ jobs: | |
make -C docs validate-links | ||
- save_deps_cache | ||
|
||
create-pr-sdk-versions-update: | ||
docker: | ||
- image: circleci/openjdk:11 | ||
steps: | ||
- github-cli/setup | ||
- checkout | ||
- restore_deps_cache | ||
- setup_sbt | ||
- set-sdk-version | ||
- run: | ||
name: Create PR to update all sdk versions (samples, sbt and maven) | ||
command: | | ||
chmod +x ./updateSdkVersions.sh | ||
bash ./updateSdkVersions.sh all | ||
BRANCH=bump-sdk-versions-$SDK_VERSION | ||
git checkout -b $BRANCH | ||
git config user.name "Kalix Bot" | ||
git config user.email "[email protected]" | ||
git commit . -m "Bump SDK versions to $SDK_VERSION" | ||
git remote add origin-rw https://[email protected]/lightbend/kalix-jvm-sdk | ||
git push --set-upstream origin-rw $BRANCH | ||
gh pr create -B main -t "Auto PR - Bump SDK versions to $SDK_VERSION" -b "This PR should update all existing samples (pom.xml and plugins.sbt) and the maven-java poms. Please review, and merge if okay. [$CIRCLE_SHA1]($CIRCLE_BUILD_URL)" || echo "No changes"; exit 0 | ||
tests: | ||
docker: | ||
- image: cimg/openjdk:11.0 | ||
|
@@ -1424,6 +1450,16 @@ workflows: | |
- publish-maven | ||
- publish-tck | ||
|
||
- create-pr-sdk-versions-update: | ||
filters: # version tags only | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
requires: | ||
# we only create the versions bump PR after publish-docs is successful, which means release was successful | ||
- publish-docs | ||
|
||
Nightly: | ||
triggers: | ||
- schedule: | ||
|
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,57 @@ | ||
#!/bin/bash | ||
|
||
# this script is meant to be used after a new SDK version is out | ||
# to facilitate the update of all the places where we usually depend on the latest version | ||
|
||
# provide the new sdk version you want the project to be updated to | ||
if [[ -z "$SDK_VERSION" ]]; then | ||
echo "Must provide SDK_VERSION in environment" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
updateJavaSamples() { | ||
echo ">>> Updating pom versions to $SDK_VERSION" | ||
PROJS=$(find $1 -type f -name "pom.xml") | ||
for i in ${PROJS[@]} | ||
do | ||
echo "Updating pom for: $i" | ||
sed -i .bak "s/<kalix-sdk.version>\(.*\)<\/kalix-sdk.version>/<kalix-sdk.version>$SDK_VERSION<\/kalix-sdk.version>/" $i | ||
rm $i.bak | ||
done | ||
} | ||
|
||
updateScalaSamples() { | ||
echo ">>> Updating sbt plugins to $SDK_VERSION" | ||
PROJS=$(find $1 -type f -name "*plugins.sbt") | ||
for i in ${PROJS[@]} | ||
do | ||
echo "Updating plugins sbt for: $i" | ||
sed -i .bak "s/System.getProperty(\"kalix-sdk.version\", \".*\"))/System.getProperty(\"kalix-sdk.version\", \"$SDK_VERSION\"))/" $i | ||
rm $i.bak | ||
done | ||
} | ||
|
||
updateMavenPlugin() { | ||
echo ">>> Updating maven plugin to $SDK_VERSION" | ||
cd maven-java && mvn versions:set -DnewVersion="$SDK_VERSION" | ||
} | ||
|
||
DEFAULT_SAMPLES="./samples" | ||
option="${1}" | ||
sample="${2:-$DEFAULT_SAMPLES}" | ||
case ${option} in | ||
java) updateJavaSamples $sample | ||
;; | ||
scala) updateScalaSamples $sample | ||
;; | ||
plugin) updateMavenPlugin | ||
;; | ||
all) | ||
updateJavaSamples $sample; updateScalaSamples $sample; updateMavenPlugin | ||
;; | ||
*) | ||
echo "`basename ${0}`:usage: java|scala|plugin|all [project-folder]" | ||
echo "e.g.: `basename ${0}` java ./samples/java-customer-registry-kafka-quickstart/" | ||
exit 1 # Command to come out of the program with status 1 | ||
;; | ||
esac |