Update Spring Dependencies #848
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
#1. Get `SPRING_BOOT_VERSION` from [spring-boot-dependencies tags](https://github.com/spring-projects/spring-boot/tags). Get `SPRING_CLOUD_VERSION` from [spring-cloud-dependencies tags](https://github.com/spring-cloud/spring-cloud-release/tags). Note that spring-cloud version should compatible with spring-boot version. Refs: [Spring Cloud Release train Spring Boot compatibility](https://spring.io/projects/spring-cloud). | |
#2. Run command `python .\sdk\spring\scripts\get_spring_boot_managed_external_dependencies.py -b ${SPRING_BOOT_VERSION} -c ${SPRING_CLOUD_VERSION}`. Then a file named `spring_boot_SPRING_BOOT_VERSION_managed_external_dependencies.txt` will be created in `.\sdk\spring\scripts`. | |
#3. Run command `python .\sdk\spring\scripts\sync_external_dependencies.py -b ${SPRING_BOOT_VERSION} -sbmvn 3`. Then versions in `\eng\versioning\external_dependencies.txt` will be synchronized with `spring_boot_${SPRING_BOOT_VERSION}_managed_external_dependencies.txt`. | |
#4. Run command `python .\eng\versioning\update_versions.py --ut external_dependency --sr` | |
#5. Run command: `python .\sdk\spring\scripts\update_changelog.py -b ${SPRING_BOOT_VERSION} -c ${SPRING_CLOUD_VERSION}` to update changelog about Spring Boot and Spring Cloud dependencies versions in `/sdk/spring/CHANGELOG.md`. | |
#6. When generate `spring_boot_${SPRING_BOOT_VERSION}_managed_external_dependencies.txt` file, delete the old version file. | |
name: Update Spring Dependencies | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: 'Azure/spring-cloud-azure-tools' | |
- name: Generate Version File | |
run: | | |
mvn compile | |
mvn exec:java -P github-actions -ntp -Dupdate-spring-dependencies=true | |
- name: Confirm Whether to Update | |
run: | | |
if [[ $(git ls-remote --heads ${{ secrets.BRANCH_REPO }} update-spring-dependencies | wc -l) -eq 0 ]]; then | |
echo "Remote branch doesn't exist" | |
if [[ ! -f 'spring-versions.txt' ]]; then | |
echo "No new Spring Boot version, No updates!" | |
elif grep -q - 'spring-versions.txt'; then | |
echo "Has non-GA version, cancel update!" | |
else | |
echo "need_update_version=true" >> $GITHUB_ENV | |
echo "spring_boot_version=$(sed -n '1p' spring-versions.txt)" >> $GITHUB_ENV | |
echo "spring_cloud_version=$(sed -n '2p' spring-versions.txt)" >> $GITHUB_ENV | |
echo "last_spring_boot_version=$(sed -n '3p' spring-versions.txt)" >> $GITHUB_ENV | |
echo "last_spring_cloud_version=$(sed -n '4p' spring-versions.txt)" >> $GITHUB_ENV | |
echo "pr_descriptions=$(cat pr-descriptions.txt)" >> $GITHUB_ENV | |
fi | |
else | |
echo "Remote branch exists, cancel commit" | |
fi | |
- uses: actions/checkout@v3 | |
if: ${{ env.need_update_version == 'true' }} | |
with: | |
repository: 'Azure/azure-sdk-for-java' | |
path: 'azure-sdk-for-java' | |
ref: main | |
token: ${{ secrets.ACCESS_TOKEN }} | |
fetch-depth: 0 | |
- name: Generate spring_boot_managed_external_dependencies.txt | |
if: ${{ env.need_update_version == 'true' }} | |
run: | | |
echo Updating Spring Boot Dependencies Version: ${{ env.spring_boot_version }} | |
echo Updating Spring Cloud Dependencies Version: ${{ env.spring_cloud_version }} | |
cd azure-sdk-for-java | |
git checkout -b update-spring-dependencies | |
pip install termcolor | |
python ./sdk/spring/scripts/get_spring_boot_managed_external_dependencies.py -b ${{ env.spring_boot_version }} -c ${{ env.spring_cloud_version }} | |
- name: Update external_dependencies.txt | |
if: ${{ env.need_update_version == 'true' }} | |
run: | | |
cd azure-sdk-for-java | |
pip install termcolor | |
pip install in_place | |
python ./sdk/spring/scripts/sync_external_dependencies.py -b ${{ env.spring_boot_version }} -sbmvn 3 | |
- name: Update Versions | |
if: ${{ env.need_update_version == 'true' }} | |
run: | | |
cd azure-sdk-for-java | |
python ./eng/versioning/update_versions.py --ut external_dependency --sr | |
- name: Update ChangeLog | |
if: ${{ env.need_update_version == 'true' }} | |
run: | | |
cd azure-sdk-for-java | |
python ./sdk/spring/scripts/update_changelog.py -b ${{ env.spring_boot_version }} -c ${{ env.spring_cloud_version }} | |
- name: Push Commit | |
if: ${{ env.need_update_version == 'true' }} | |
run: | | |
cd azure-sdk-for-java | |
git config --global user.email github-actions@github.com | |
git config --global user.name github-actions | |
git rm ./sdk/spring/scripts/spring_boot_${{ env.last_spring_boot_version }}_managed_external_dependencies.txt | |
git add -A | |
git commit -m "Upgrade external dependencies to align with Spring Boot ${{ env.spring_boot_version }}" | |
git push "https://${{ secrets.USER }}:${{ secrets.ACCESS_TOKEN }}@github.com/${{ secrets.USER }}/azure-sdk-for-java.git" | |
- name: Create Pull Request | |
if: ${{ env.need_update_version == 'true' }} | |
uses: vsoch/pull-request-action@master | |
env: | |
PULL_REQUEST_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
PULL_REQUEST_REPOSITORY: Azure/azure-sdk-for-java | |
PULL_REQUEST_TITLE: "External dependencies upgrade - Spring Boot ${{ env.spring_boot_version }} and Spring Cloud ${{ env.spring_cloud_version }}" | |
PULL_REQUEST_FROM_BRANCH: "${{ secrets.USER }}:update-spring-dependencies" | |
PULL_REQUEST_BRANCH: "main" | |
PULL_REQUEST_BODY: "Updates external dependencies to align with Spring Boot version [${{ env.spring_boot_version }}](https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/${{ env.spring_boot_version }}/spring-boot-dependencies-${{ env.spring_boot_version }}.pom) from [${{ env.last_spring_boot_version }}](https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/${{ env.last_spring_boot_version }}/spring-boot-dependencies-${{ env.last_spring_boot_version }}.pom) and Spring Cloud version [${{ env.spring_cloud_version }}](https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dependencies/${{ env.spring_cloud_version }}/spring-cloud-dependencies-${{ env.spring_cloud_version }}.pom) from [${{ env.last_spring_cloud_version }}](https://repo1.maven.org/maven2/org/springframework/cloud/spring-cloud-dependencies/${{ env.last_spring_cloud_version }}/spring-cloud-dependencies-${{ env.last_spring_cloud_version }}.pom).\n${{ env.pr_descriptions }}\n\nThis PR is created by GitHub Actions: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}" | |
PULL_REQUEST_DRAFT: true |