From 3149a1a346bbba1baed6dab88c32f125fee5daea Mon Sep 17 00:00:00 2001 From: Rick M Date: Mon, 11 Nov 2024 16:36:41 -0500 Subject: [PATCH 1/3] Automate rolling of SNAPSHOT version in pom Follow-up to discussion in: https://github.com/datafaker-net/datafaker/issues/1412 --- .github/workflows/pom_update.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 3 ++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pom_update.yml diff --git a/.github/workflows/pom_update.yml b/.github/workflows/pom_update.yml new file mode 100644 index 000000000..4972e9312 --- /dev/null +++ b/.github/workflows/pom_update.yml @@ -0,0 +1,29 @@ +on: + workflow_call: + +permissions: + contents: write + pull-requests: write + +jobs: + create_pr: + name: Create Pull Request + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Git + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + echo "BRANCH=pom-snapshot-updt" >> $GITHUB_ENV + - name: Build PR + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + git checkout -b $BRANCH + ./mvnw build-helper:parse-version versions:set -DnewVersion=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}-SNAPSHOT + git add . + git commit -m "Update pom SNAPSHOT version" -m "A release just completed, this PR increments the SNAPSHOT version in pom.xml" --signoff + git push --set-upstream origin $BRANCH --force + gh pr create --fill diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9447d55c9..75b42fee8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,4 +69,5 @@ jobs: ${{ steps.changelog.outputs.changelog }} draft: false prerelease: false - + call_pom_update: + uses: ./.github/workflows/pom_update.yml From df7a4f4ad808b16ea814d9395e04292392b198ad Mon Sep 17 00:00:00 2001 From: Rick M Date: Mon, 11 Nov 2024 16:38:55 -0500 Subject: [PATCH 2/3] Need publish job to run sequentially --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75b42fee8..c633a9787 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,4 +70,5 @@ jobs: draft: false prerelease: false call_pom_update: + needs: publish uses: ./.github/workflows/pom_update.yml From bff2854a104174e3ee30fdb123ca27460e312524 Mon Sep 17 00:00:00 2001 From: Rick M Date: Mon, 11 Nov 2024 16:51:13 -0500 Subject: [PATCH 3/3] Fix escaping --- .github/workflows/pom_update.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pom_update.yml b/.github/workflows/pom_update.yml index 4972e9312..d064846c7 100644 --- a/.github/workflows/pom_update.yml +++ b/.github/workflows/pom_update.yml @@ -22,7 +22,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git checkout -b $BRANCH - ./mvnw build-helper:parse-version versions:set -DnewVersion=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.nextIncrementalVersion}-SNAPSHOT + ./mvnw build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT git add . git commit -m "Update pom SNAPSHOT version" -m "A release just completed, this PR increments the SNAPSHOT version in pom.xml" --signoff git push --set-upstream origin $BRANCH --force