Update Versions for Java Extension #672
This file contains hidden or 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
| name: Update Versions for Java Extension | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 14 * * *" # cron schedule uses UTC timezone. Run tests at the beginning of the day in US-East | |
| jobs: | |
| bump_version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read # read secrets | |
| id-token: write # Needed to federate tokens for dd-octo-sts | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Modify build-packages | |
| id: version | |
| run: | | |
| CURRENT_TRACER_VERSION=$(awk '/TRACER_VERSION=/{print}' java/scripts/build-packages.sh | awk -F '=' '{print $2}' | tr -d '"') | |
| TRACER_RESPONSE=$(curl -s "https://api.github.com/repos/datadog/dd-trace-java/releases") | |
| TRACER_VERSION=$(echo "$TRACER_RESPONSE" | jq -r --arg pattern "v1\.[0-9]*\.[0-9]*" '.[] | select(.tag_name | test($pattern)) | .tag_name | ltrimstr("v")' | sort -V | tail -n 1) | |
| if [ "$CURRENT_TRACER_VERSION" != "$TRACER_VERSION" ]; then | |
| echo "Updating tracer to version: $TRACER_VERSION" | |
| sed -i -e "s/TRACER_VERSION=\"[0-9]*\.[0-9]*\.[0-9]*\"/TRACER_VERSION=\"$TRACER_VERSION\"/" java/scripts/build-packages.sh | |
| PR_BODY="Bumps the tracer version to $TRACER_VERSION for the Java Extension." | |
| PR_TITLE="[Java Extension] Bump tracer to $TRACER_VERSION" | |
| fi | |
| echo "pr_body=$PR_BODY" >> "$GITHUB_OUTPUT" | |
| echo "pr_title=$PR_TITLE" >> "$GITHUB_OUTPUT" | |
| - uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3 | |
| id: octo-sts | |
| with: | |
| scope: DataDog/datadog-aas-extension | |
| policy: self.java-extension-update-versions.create-pr | |
| - name: Create Pull Request | |
| id: pr | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ steps.octo-sts.outputs.token }} | |
| branch: "java-extension-version-bump" | |
| commit-message: "${{steps.version.outputs.pr_title}}" | |
| delete-branch: true | |
| title: "${{steps.version.outputs.pr_title}}" | |
| body: "${{steps.version.outputs.pr_body}}" | |
| - name: Display output | |
| run: | | |
| echo "Pull Request Number - ${{ steps.pr.outputs.pull-request-number }}" | |
| echo "Pull Request URL - ${{ steps.pr.outputs.pull-request-url }}" |