From fc425532ae87f91bcb094fbb12308f8810e483fd Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 22 Jan 2025 19:37:11 -0800 Subject: [PATCH 1/4] More release automation --- .../workflows/auto-update-spec-repo-links.yml | 80 +++++++++++++++++++ .../scripts/update-spec-repo-links.sh | 8 +- 2 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/auto-update-spec-repo-links.yml rename internal/tools/update_specification_version.sh => .github/workflows/scripts/update-spec-repo-links.sh (87%) diff --git a/.github/workflows/auto-update-spec-repo-links.yml b/.github/workflows/auto-update-spec-repo-links.yml new file mode 100644 index 0000000000..3d8b5b2a85 --- /dev/null +++ b/.github/workflows/auto-update-spec-repo-links.yml @@ -0,0 +1,80 @@ +name: Auto-update spec repo links +on: + schedule: + # hourly at minute 46 + - cron: "46 * * * *" + workflow_dispatch: + +jobs: + check-versions: + runs-on: ubuntu-latest + outputs: + current-version: ${{ steps.check-versions.outputs.current-version }} + latest-version: ${{ steps.check-versions.outputs.latest-version }} + already-opened: ${{ steps.check-versions.outputs.already-opened }} + steps: + - uses: actions/checkout@v4 + + - id: check-versions + name: Check versions + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + current_version=$(grep "PREVIOUS_SPECIFICATION_VERSION=v.*" \ + internal/tools/update_specification_version.sh \ + | sed "s/PREVIOUS_SPECIFICATION_VERSION=//") + latest_version=$(gh release view \ + --repo open-telemetry/opentelemetry-specification \ + --json tagName \ + --jq .tagName) + + matches=$(gh pr list \ + --author opentelemetrybot \ + --state open \ + --search "in:title \"Update spec repo links to $latest_version\"") + if [ ! -z "$matches" ] + then + already_opened=true + fi + + echo "current-version=$current_version" >> $GITHUB_OUTPUT + echo "latest-version=$latest_version" >> $GITHUB_OUTPUT + echo "already-opened=$already_opened" >> $GITHUB_OUTPUT + + update-spec-repo-links: + runs-on: ubuntu-latest + if: | + needs.check-versions.outputs.current-version != needs.check-versions.outputs.latest-version && + needs.check-versions.outputs.already-opened != 'true' + needs: + - check-versions + steps: + - uses: actions/checkout@v4 + + - name: Use CLA approved github bot + run: .github/workflows/scripts/use-cla-approved-github-bot.sh + + - name: Update version + env: + VERSION: ${{ needs.check-versions.outputs.latest-version }} + run: | + .github/workflows/scripts/update-spec-repo-links.sh $VERSION + sed -i "s/^PREVIOUS_SPECIFICATION_VERSION=.*/PREVIOUS_SPECIFICATION_VERSION=$VERSION/" .github/workflows/scripts/update-spec-repo-links.sh + + - name: Create pull request + env: + VERSION: ${{ needs.check-versions.outputs.latest-version }} + # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows + GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + run: | + message="Update spec repo links to $VERSION" + body="Update spec repo links to \`$VERSION\`." + branch="opentelemetrybot/update-spec-repo-links-to-$VERSION" + + git checkout -b $branch + git commit -a -m "$message" + git push --set-upstream origin $branch + gh pr create --title "$message" \ + --body "$body" \ + --label "Skip Changelog" \ + --base main diff --git a/internal/tools/update_specification_version.sh b/.github/workflows/scripts/update-spec-repo-links.sh similarity index 87% rename from internal/tools/update_specification_version.sh rename to .github/workflows/scripts/update-spec-repo-links.sh index 33b6650c5e..e99724a7c1 100755 --- a/internal/tools/update_specification_version.sh +++ b/.github/workflows/scripts/update-spec-repo-links.sh @@ -2,13 +2,13 @@ # Example usage: # -# ./internal/tools/update_specification_version.sh +# ./internal/tools/update-spec-repo-links.sh v1.41.0 +# this version should be kept up-to-date with the spec version that links use +PREVIOUS_SPECIFICATION_VERSION=v1.40.0 -# Set this to the version number you want to CHANGE in URLs in the repository. -PREVIOUS_SPECIFICATION_VERSION="v1.39.0" # Set this to the version number you want to KEEP in URLs in the repository. -LATEST_SPECIFICATION_VERSION="v1.40.0" +LATEST_SPECIFICATION_VERSION=$1 # The specific pattern we look for when replacing URLs SPECIFICATION_URL_PREFIX="https://github.com/open-telemetry/opentelemetry-specification/tree/" SPECIFICATION_BLOB_URL_PREFIX="https://github.com/open-telemetry/opentelemetry-specification/blob/" From e7975c572c1664ca21c7d9d7fc1cc9a785bba584 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 22 Jan 2025 20:28:43 -0800 Subject: [PATCH 2/4] move scripts outside of workflows dir --- .github/{workflows => }/scripts/prepare-new-issue.sh | 0 .github/{workflows => }/scripts/prepare-new-pr.sh | 0 .github/{workflows => }/scripts/update-spec-repo-links.sh | 0 .../{workflows => }/scripts/use-cla-approved-github-bot.sh | 0 .github/workflows/auto-update-spec-repo-links.yml | 6 +++--- .github/workflows/prepare-new-issue.yml | 2 +- .github/workflows/prepare-new-pr.yml | 2 +- .github/workflows/prepare-release.yml | 2 +- 8 files changed, 6 insertions(+), 6 deletions(-) rename .github/{workflows => }/scripts/prepare-new-issue.sh (100%) rename .github/{workflows => }/scripts/prepare-new-pr.sh (100%) rename .github/{workflows => }/scripts/update-spec-repo-links.sh (100%) rename .github/{workflows => }/scripts/use-cla-approved-github-bot.sh (100%) diff --git a/.github/workflows/scripts/prepare-new-issue.sh b/.github/scripts/prepare-new-issue.sh similarity index 100% rename from .github/workflows/scripts/prepare-new-issue.sh rename to .github/scripts/prepare-new-issue.sh diff --git a/.github/workflows/scripts/prepare-new-pr.sh b/.github/scripts/prepare-new-pr.sh similarity index 100% rename from .github/workflows/scripts/prepare-new-pr.sh rename to .github/scripts/prepare-new-pr.sh diff --git a/.github/workflows/scripts/update-spec-repo-links.sh b/.github/scripts/update-spec-repo-links.sh similarity index 100% rename from .github/workflows/scripts/update-spec-repo-links.sh rename to .github/scripts/update-spec-repo-links.sh diff --git a/.github/workflows/scripts/use-cla-approved-github-bot.sh b/.github/scripts/use-cla-approved-github-bot.sh similarity index 100% rename from .github/workflows/scripts/use-cla-approved-github-bot.sh rename to .github/scripts/use-cla-approved-github-bot.sh diff --git a/.github/workflows/auto-update-spec-repo-links.yml b/.github/workflows/auto-update-spec-repo-links.yml index 3d8b5b2a85..f82939d1d8 100644 --- a/.github/workflows/auto-update-spec-repo-links.yml +++ b/.github/workflows/auto-update-spec-repo-links.yml @@ -52,14 +52,14 @@ jobs: - uses: actions/checkout@v4 - name: Use CLA approved github bot - run: .github/workflows/scripts/use-cla-approved-github-bot.sh + run: .github/scripts/use-cla-approved-github-bot.sh - name: Update version env: VERSION: ${{ needs.check-versions.outputs.latest-version }} run: | - .github/workflows/scripts/update-spec-repo-links.sh $VERSION - sed -i "s/^PREVIOUS_SPECIFICATION_VERSION=.*/PREVIOUS_SPECIFICATION_VERSION=$VERSION/" .github/workflows/scripts/update-spec-repo-links.sh + .github/scripts/update-spec-repo-links.sh $VERSION + sed -i "s/^PREVIOUS_SPECIFICATION_VERSION=.*/PREVIOUS_SPECIFICATION_VERSION=$VERSION/" .github/scripts/update-spec-repo-links.sh - name: Create pull request env: diff --git a/.github/workflows/prepare-new-issue.yml b/.github/workflows/prepare-new-issue.yml index f17a144fca..a6221074e5 100644 --- a/.github/workflows/prepare-new-issue.yml +++ b/.github/workflows/prepare-new-issue.yml @@ -11,7 +11,7 @@ jobs: - uses: actions/checkout@v4 - name: Run prepare-new-issue.sh - run: ./.github/workflows/scripts/prepare-new-issue.sh + run: ./.github/scripts/prepare-new-issue.sh env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ISSUE: ${{ github.event.issue.number }} diff --git a/.github/workflows/prepare-new-pr.yml b/.github/workflows/prepare-new-pr.yml index eccca9f12d..926b52017a 100644 --- a/.github/workflows/prepare-new-pr.yml +++ b/.github/workflows/prepare-new-pr.yml @@ -26,7 +26,7 @@ jobs: # we're going to run prepare-new-pr script from the main branch # to parse changelog record from the PR branch. - name: Run prepare-new-pr.sh - run: ./.github/workflows/scripts/prepare-new-pr.sh + run: ./.github/scripts/prepare-new-pr.sh env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR: ${{ github.event.pull_request.number }} diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index f53766c277..218fbe07bb 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -21,7 +21,7 @@ jobs: fi - name: Use CLA approved github bot - run: .github/workflows/scripts/use-cla-approved-github-bot.sh + run: .github/scripts/use-cla-approved-github-bot.sh - name: Update schema files run: | From 4197694c91e2e679f6704f3fd5f7ca5e9c6e8d87 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 22 Jan 2025 20:32:42 -0800 Subject: [PATCH 3/4] Update docs --- CONTRIBUTING.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e2b4b153e1..0d37634e9c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,7 +34,6 @@ requirements and recommendations. - [Misspell check](#misspell-check) - [Update the tables of content](#update-the-tables-of-content) - [Markdown link check](#markdown-link-check) -- [Updating the referenced specification version](#updating-the-referenced-specification-version) - [Merging existing ECS conventions](#merging-existing-ecs-conventions) @@ -406,14 +405,6 @@ To check the validity of links in all markdown files, run the following command: make markdown-link-check ``` -## Updating the referenced specification version - -1. Open the `./internal/tools/update_specification_version.sh` script. -2. Modify the `PREVIOUS_SPECIFICATION_VERSION` to be the same value as `LATEST_SPECIFICATION_VERSION` -3. Modify `LATEST_SPECIFICATION_VERSION` to the latest specification tag, e.g. `1.21` -4. Run the script from the root directory, e.g. `semantic-conventions$ ./internal/tools/update_specification_version.sh`. -5. Add all modified files to the change submit and submit a PR. - ## Merging existing ECS conventions The Elastic Common Schema (ECS) is being merged into OpenTelemetry Semantic From 568ccc8d09702f912dfb9cb58696856eb7b70bc4 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Thu, 23 Jan 2025 07:31:40 -0800 Subject: [PATCH 4/4] Remove step from releasing --- RELEASING.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 683e009dde..8afdf8c505 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -4,9 +4,6 @@ - Close the [release milestone](https://github.com/open-telemetry/semantic-conventions/milestones) if there is one. -- Ensure the referenced specification version is up to date. Use - [tooling to update the spec](./CONTRIBUTING.md#updating-the-referenced-specification-version) - if needed. - Run [opentelemetry.io workflow](https://github.com/open-telemetry/opentelemetry.io/actions/workflows/build-dev.yml) against `semantic-conventions` submodule as a smoke-test for docs. Fix broken links, if any. - Run the [prepare release workflow](https://github.com/open-telemetry/semantic-conventions/actions/workflows/prepare-release.yml).