diff --git a/.github/workflows/update-platform-branch.yaml b/.github/workflows/update-platform-branch.yaml index fe6833d7..11e972d7 100644 --- a/.github/workflows/update-platform-branch.yaml +++ b/.github/workflows/update-platform-branch.yaml @@ -18,8 +18,8 @@ on: inputs: tag: description: "The new tag or branch to update the platform.branch property to use for targeting the RPC protocol buffers." - required: true - default: "protocol/go/v0.3.0" + # required: true + # default: "protocol/go/v0.3.0" jobs: update-platform-branch: @@ -35,6 +35,14 @@ jobs: with: persist-credentials: true + - name: Set up GitHub CLI as Actions bot + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh auth setup-git + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + - name: Fetch latest semver tag for protocol/go id: fetch-latest-tag run: | @@ -76,19 +84,21 @@ jobs: git checkout update-platform-branch - name: Update platform.branch in pom.xml files + id: update-platform-branch run: | find . -name "pom.xml" -exec sed -i.bak "s|.*|${LATEST_TAG}|g" {} \; CHANGED_FILES=$(find . -name "pom.xml" -exec diff -u {} {}.bak \;) if [ -z "$CHANGED_FILES" ]; then echo "No changes detected in pom.xml files." | tee -a $GITHUB_STEP_SUMMARY find . -name "pom.xml.bak" -delete - exit 1 + echo "no_updates=true" >> $GITHUB_OUTPUT + exit 0 fi echo "The following pom.xml files were updated: $CHANGED_FILES" find . -name "pom.xml.bak" -delete - name: Create new branch - if: steps.check-pr.outputs.EXISTING_PR == '' + if: steps.check-pr.outputs.EXISTING_PR == '' && steps.update-platform-branch.outputs.no_updates != 'true' run: | git checkout -b update-platform-branch git add . @@ -96,25 +106,29 @@ jobs: git push origin update-platform-branch - name: Update existing PR - if: steps.check-pr.outputs.EXISTING_PR != '' + if: steps.check-pr.outputs.EXISTING_PR != '' && steps.update-platform-branch.outputs.no_updates != 'true' run: | git add . git commit --amend --no-edit git push origin update-platform-branch --force - name: Create New PR - if: steps.check-pr.outputs.EXISTING_PR == '' - uses: peter-evans/create-pull-request@v7.0.8 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "fix(sdk): Updates to proto version $LATEST_TAG" - branch: update-platform-branch - title: "fix(sdk): Updates to proto version $LATEST_TAG" - body: | - This PR updates the platform.branch property in all pom.xml files to the new tag or branch: $LATEST_TAG. + if: steps.check-pr.outputs.EXISTING_PR == '' && steps.update-platform-branch.outputs.no_updates != 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + RELEASE_NOTES=$(gh release view protocol/go/$LATEST_TAG --repo opentdf/platform --json body --jq '.body') + cat < pr_body.txt + This PR updates the platform.branch property in all pom.xml files to the new tag or branch: $LATEST_TAG. + + See the release: https://github.com/opentdf/platform/releases/tag/protocol%2Fgo%2F$LATEST_TAG - See the release: https://github.com/opentdf/platform/releases/tag/$LATEST_TAG + Release Notes: + $RELEASE_NOTES + EOF + gh pr create \ + --title "fix(sdk): Updates to proto version $LATEST_TAG" \ + --body-file pr_body.txt \ + --head update-platform-branch \ + --base main \ - Release Notes: - $RELEASE_NOTES - labels: "automated-update" diff --git a/examples/pom.xml b/examples/pom.xml index 3bcd1e02..f09d90dd 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -17,7 +17,7 @@ UTF-8 11 - protocol/go/v0.3.0 + v0.13.0 diff --git a/sdk/pom.xml b/sdk/pom.xml index 1ced4176..8509350c 100644 --- a/sdk/pom.xml +++ b/sdk/pom.xml @@ -16,7 +16,7 @@ 2.1.0 0.7.2 4.12.0 - protocol/go/v0.11.0 + v0.13.0