diff --git a/.github/scripts/generate-release-contributors.sh b/.github/scripts/generate-release-contributors.sh index 06e4d0cc..88d1bfc2 100755 --- a/.github/scripts/generate-release-contributors.sh +++ b/.github/scripts/generate-release-contributors.sh @@ -84,7 +84,7 @@ echo $contributors1 $contributors2 \ | sort -uf \ | grep -v linux-foundation-easycla \ | grep -v github-actions \ - | grep -v dependabot \ + | grep -v renovate \ + | grep -v otelbot \ | grep -v codecov \ - | grep -v opentelemetrybot \ | sed 's/^/@/' diff --git a/.github/scripts/use-cla-approved-github-bot.sh b/.github/scripts/use-cla-approved-github-bot.sh index a4c68b0e..149a13d9 100755 --- a/.github/scripts/use-cla-approved-github-bot.sh +++ b/.github/scripts/use-cla-approved-github-bot.sh @@ -1,4 +1,4 @@ #!/bin/bash -e -git config user.name opentelemetrybot -git config user.email 107717825+opentelemetrybot@users.noreply.github.com +git config user.name otelbot +git config user.email 197425009+otelbot@users.noreply.github.com diff --git a/.github/workflows/generate-post-release-pr.yml b/.github/workflows/generate-post-release-pr.yml deleted file mode 100644 index e1d77f20..00000000 --- a/.github/workflows/generate-post-release-pr.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: Generate Post-Release PR -on: - workflow_dispatch: - -permissions: - contents: read - -jobs: - prereqs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Verify prerequisites - run: | - if [[ $GITHUB_REF_NAME != main ]]; then - echo this workflow should only be run against main - exit 1 - fi - - create-pull-request-against-main: - permissions: - contents: write # for git push to PR branch - runs-on: ubuntu-latest - needs: - - prereqs - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - id: setup-java - name: Set up Java for build - uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1 - with: - distribution: temurin - java-version: 17 - - - name: Set environment variables - run: | - version=$(.github/scripts/get-version.sh) - echo "VERSION=$version" >> $GITHUB_ENV - prior_version=$(.github/scripts/get-prior-version.sh) - echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV - if [[ $prior_version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then - major="${BASH_REMATCH[1]}" - minor="${BASH_REMATCH[2]}" - patch="${BASH_REMATCH[3]}" - - two_releases_ago="$major.$((minor - 1)).$patch" - else - echo "unexpected prior version: $prior_version" - exit 1 - fi - echo "TWO_VERSIONS_AGO=$two_releases_ago" >> $GITHUB_ENV - - name: Use CLA approved github bot - run: .github/scripts/use-cla-approved-github-bot.sh - - - name: Create pull request against main - env: - # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} - run: | - ./gradlew japicmp -PapiBaseVersion=$TWO_VERSIONS_AGO -PapiNewVersion=$PRIOR_VERSION - ./gradlew --refresh-dependencies japicmp - - message="Post release for version $PRIOR_VERSION" - body="Post-release updates for version \`$PRIOR_VERSION\`." - branch="opentelemetrybot/post-release-for-${PRIOR_VERSION}" - - git checkout -b $branch - git add docs/apidiffs - git commit -a -m "$message" - git push --set-upstream origin $branch - gh pr create --title "$message" \ - --body "$body" \ - --base main diff --git a/.github/workflows/prepare-release-branch.yml b/.github/workflows/prepare-release-branch.yml index 82b9d945..8916d7a8 100644 --- a/.github/workflows/prepare-release-branch.yml +++ b/.github/workflows/prepare-release-branch.yml @@ -63,13 +63,19 @@ jobs: - name: Use CLA approved github bot run: .github/scripts/use-cla-approved-github-bot.sh + - uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2 + id: otelbot-token + with: + app-id: ${{ vars.OTELBOT_APP_ID }} + private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }} + - name: Create pull request against the release branch env: # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.otelbot-token.outputs.token }} run: | message="Prepare release $VERSION" - branch="opentelemetrybot/prepare-release-${VERSION}" + branch="otelbot/prepare-release-${VERSION}" git checkout -b $branch git commit -a -m "$message" @@ -105,14 +111,20 @@ jobs: - name: Use CLA approved github bot run: .github/scripts/use-cla-approved-github-bot.sh + - uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2 + id: otelbot-token + with: + app-id: ${{ vars.OTELBOT_APP_ID }} + private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }} + - name: Create pull request against main env: # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows - GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.otelbot-token.outputs.token }} run: | message="Update changelog for $VERSION release" body="Update changelog for \`$VERSION\` release." - branch="opentelemetrybot/update-version-to-${VERSION}" + branch="otelbot/update-version-to-${VERSION}" git checkout -b $branch git commit -a -m "$message" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 155f7ebb..710a2588 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ steps.create-github-release.outputs.version }} + prior-version: ${{ steps.create-github-release.outputs.prior-version }} steps: - run: | if [[ $GITHUB_REF_NAME != release/* ]]; then @@ -114,4 +115,86 @@ jobs: --notes-file /tmp/release-notes.txt \ v$VERSION + # these are used as job outputs echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "prior-version=$PRIOR_VERSION" >> $GITHUB_OUTPUT + + update-apidiff-baseline-to-released-version: + permissions: + contents: write # for git push to PR branch + runs-on: ubuntu-latest + needs: + - release + steps: + # add change log sync (if any) into this PR since the apidiff update + # is required before any other PR can be merged anyway + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Copy change log section from release branch + env: + VERSION: ${{ needs.release.outputs.version }} + run: | + sed -n "0,/^## Version $VERSION /d;/^## Version /q;p" CHANGELOG.md \ + > /tmp/changelog-section.md + + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: main + + - name: Merge change log to main + env: + VERSION: ${{ needs.release.outputs.version }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + release_date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//') + RELEASE_DATE=$release_date .github/scripts/merge-change-log-after-release.sh + git add CHANGELOG.md + + - name: Wait for release to be available in maven central + env: + VERSION: ${{ needs.release.outputs.version }} + run: | + until curl --silent \ + --show-error \ + --output /dev/null \ + --head \ + --fail \ + https://repo1.maven.org/maven2/io/opentelemetry/semconv/opentelemetry-semconv/$VERSION/opentelemetry-semconv-$VERSION.jar + do + sleep 60 + done + + - name: Update apidiff baseline + env: + VERSION: ${{ needs.release.outputs.version }} + PRIOR_VERSION: ${{ needs.release.outputs.prior-version }} + run: | + ./gradlew japicmp -PapiBaseVersion=$PRIOR_VERSION -PapiNewVersion=$VERSION + ./gradlew --refresh-dependencies japicmp + git add docs/apidiffs + + - name: Use CLA approved bot + run: .github/scripts/use-cla-approved-bot.sh + + - uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6 + id: otelbot-token + with: + app-id: ${{ vars.OTELBOT_APP_ID }} + private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }} + + - name: Create pull request against main + env: + VERSION: ${{ needs.release.outputs.version }} + # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows + GH_TOKEN: ${{ steps.otelbot-token.outputs.token }} + run: | + message="Update apidiff baseline to released version $VERSION" + body="Update apidiff baseline to released version \`$VERSION\`." + branch="otelbot/update-apidiff-baseline-to-released-version-${VERSION}" + + git checkout -b $branch + git commit -m "$message" + git push --set-upstream origin $branch + gh pr create --title "$message" \ + --body "$body" \ + --base main