version: 0.2

phases:
  pre_build:
    commands:
    - git config --global user.name "AWS"
    - git config --global user.email "<>"
    - 'PUBLIC_REPOSITORY_URL="https://$GITHUB_ACCESS_TOKEN@github.com/aws/aws-sdk-java-v2.git"'

  build:
    commands:
    - mkdir release
    - cd release
    -
    - git clone -o public -b release $PUBLIC_REPOSITORY_URL .
    -
    - RELEASE_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
    - echo "Release version - $RELEASE_VERSION"
    -
    - MAJOR=$(echo $RELEASE_VERSION | cut -d'.' -f1)
    - MINOR=$(echo $RELEASE_VERSION | cut -d'.' -f2)
    - POINT=$(echo $RELEASE_VERSION | cut -d'.' -f3)
    - NEW_VERSION_SNAPSHOT="$MAJOR.$MINOR.$((POINT + 1))-SNAPSHOT"
    - echo "New shapshot version - $NEW_VERSION_SNAPSHOT"
    -
    - git checkout master
    - git merge public/release --no-edit
    -
    - mvn versions:set -DnewVersion=$NEW_VERSION_SNAPSHOT -DgenerateBackupPoms=false -DprocessAllModules=true
    - sed -i -E "s/(<version>).+(<\/version>)/\1$RELEASE_VERSION\2/" README.md
    -
    - 'git commit -am "Update to next snapshot version: $NEXT_VERSION_SNAPSHOT"'
    -
    - git push
version: 0.2

phases:
  pre_build:
    commands:
    - git config --global user.name "AWS"
    - git config --global user.email "<>"
    - 'PUBLIC_REPOSITORY_URL="https://$GITHUB_ACCESS_TOKEN@github.com/aws/aws-sdk-java-v2.git"'

  build:
    commands:
    - mkdir release
    - cd release
    -
    - git clone -o public -b release $PUBLIC_REPOSITORY_URL .
    -
    - RELEASE_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
    - echo "Release version - $RELEASE_VERSION"
    -
    - MAJOR=$(echo $RELEASE_VERSION | cut -d'.' -f1)
    - MINOR=$(echo $RELEASE_VERSION | cut -d'.' -f2)
    - POINT=$(echo $RELEASE_VERSION | cut -d'.' -f3)
    - NEW_VERSION_SNAPSHOT="$MAJOR.$MINOR.$((POINT + 1))-SNAPSHOT"
    - echo "New shapshot version - $NEW_VERSION_SNAPSHOT"
    -
    - git checkout master
    - git merge public/release --no-edit
    -
    - mvn versions:set -DnewVersion=$NEW_VERSION_SNAPSHOT -DgenerateBackupPoms=false -DprocessAllModules=true
    - sed -i -E "s/(<version>).+(<\/version>)/\1$RELEASE_VERSION\2/" README.md
    -
    - 'git commit -am "Update to next snapshot version: $NEW_VERSION_SNAPSHOT"'
    -
    - git push
Fix snapshot version in commit message.
Fix snapshot version in commit message.
