xref: /aosp_15_r20/external/aws-sdk-java-v2/buildspecs/update-master-from-release.yml (revision 8a52c7834d808308836a99fc2a6e0ed8db339086)
1version: 0.2
2
3phases:
4  install:
5    runtime-versions:
6      java: "$JAVA_RUNTIME"
7
8  pre_build:
9    commands:
10    - git config --global user.name "AWS"
11    - git config --global user.email "<>"
12    - 'PUBLIC_REPOSITORY_URL="https://[email protected]/aws/aws-sdk-java-v2.git"'
13
14  build:
15    commands:
16    - mkdir release
17    - cd release
18    -
19    - git clone -o public -b release $PUBLIC_REPOSITORY_URL .
20    - echo 'For debugging, running version command without -q'
21    - mvn -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec
22    - RELEASE_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
23    - echo "Release version - $RELEASE_VERSION"
24    -
25    - MAJOR=$(echo $RELEASE_VERSION | cut -d'.' -f1)
26    - MINOR=$(echo $RELEASE_VERSION | cut -d'.' -f2)
27    - POINT=$(echo $RELEASE_VERSION | cut -d'.' -f3)
28    - NEW_VERSION_SNAPSHOT="$MAJOR.$MINOR.$((POINT + 1))-SNAPSHOT"
29    - echo "New snapshot version - $NEW_VERSION_SNAPSHOT"
30    -
31    - git checkout master
32    - git merge public/release --no-edit
33    -
34    - MASTER_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
35    - echo "Master version - $MASTER_VERSION"
36    -
37    - |
38      if [ "$MASTER_VERSION" != "$NEW_VERSION_SNAPSHOT" ]; then
39
40        mvn versions:set -DnewVersion=$NEW_VERSION_SNAPSHOT -DgenerateBackupPoms=false -DprocessAllModules=true || { echo "Failed to update POMs to next snapshot version"; exit 1; }
41        sed -i -E "s/(<version>).+(<\/version>)/\1$RELEASE_VERSION\2/" README.md
42        sed -i -E "s/(<awsjavasdk.previous.version>).+(<\/awsjavasdk.previous.version>)/\1$RELEASE_VERSION\2/" pom.xml
43
44        git commit -am "Update to next snapshot version: $NEW_VERSION_SNAPSHOT"
45      fi
46    -
47    - git status
48    - git push
49