diff --git a/.github/workflows/semconv-update.yml b/.github/workflows/semconv-update.yml new file mode 100644 index 00000000000..91be47a9102 --- /dev/null +++ b/.github/workflows/semconv-update.yml @@ -0,0 +1,77 @@ +name: Update semconv +on: + schedule: + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + # │ │ │ │ │ + # │ │ │ │ │ + # * * * * * + - cron: '30 1 * * *' + workflow_dispatch: {} +# Declare default permissions as read only. +permissions: read-all +jobs: + semconv-update: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + outputs: + tag: ${{ steps.semconv-get-latest-tag.outputs.tag_name }} + steps: + - name: Checkout Repo + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install Go + uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0 + with: + go-version-file: 'internal/tools/go.mod' + check-latest: true + cache-dependency-path: 'internal/tools/semconvkit/go.sum' + + - name: Tools cache + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 + env: + cache-name: go-semconvkit-cache + with: + path: .tools + key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('./internal/tools/semconvkit/**', './internal/tools/go.*') }} + + - name: Fetch latest release tag + id: semconv-get-latest-tag + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 + with: + script: | + const owner = "open-telemetry"; + const repo = "semantic-conventions"; + const latestRelease = await github.rest.repos.getLatestRelease({ + owner, + repo, + }); + if (latestRelease && latestRelease.data && latestRelease.data.tag_name) { + core.setOutput('tag_name', latestRelease.data.tag_name); + console.log(`Latest ${owner}/${repo} release tag: ${latestRelease.data.tag_name}`); + } else { + throw new Error("Failed to set latest release tag."); + } + + - name: Generate + env: + SEMCONV_LATEST_TAG: ${{ steps.semconv-get-latest-tag.outputs.tag_name }} + run: | + export TAG="${SEMCONV_LATEST_TAG:-}" + make semconv-generate + + - name: Create Pull Request + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 + with: + title: 'chore(semconv): update semconv to ${{ steps.semconv-get-latest-tag.outputs.tag_name }}' + branch: 'chore-semconv-update-to-${{ steps.semconv-get-latest-tag.outputs.tag_name }}' + body: 'Updating semconv to match [open-telemetry/semantic-conventions latest release, ${{ steps.semconv-get-latest-tag.outputs.tag_name }}](https://github.com/open-telemetry/semantic-conventions/releases/tag/${{ steps.semconv-get-latest-tag.outputs.tag_name }})' + commit-message: 'chore(semconv): update semconv to ${{ steps.semconv-get-latest-tag.outputs.tag_name }}' + labels: bot-generated diff --git a/RELEASING.md b/RELEASING.md index 1ddcdef0396..d8aa9c9a7f2 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -7,7 +7,9 @@ Create a `Version Release` issue to track the release process. ## Semantic Convention Generation New versions of the [OpenTelemetry Semantic Conventions] mean new versions of the `semconv` package need to be generated. -The `semconv-generate` make target is used for this. +This is automatically done each day by CI pipeline [semconv-update.yml](.github/workflows/semconv-update.yml), which opens a PR adding the generated package if it finds an upstream update. You can also trigger the pipeline manually via `workflow_dispatch`. + +However you can still use `semconv-generate` make target to generate the package. 1. Set the `TAG` environment variable to the semantic convention tag you want to generate. 2. Run the `make semconv-generate ...` target from this repository. @@ -15,7 +17,7 @@ The `semconv-generate` make target is used for this. For example, ```sh -export TAG="v1.30.0" # Change to the release version you are generating. +export TAG="v1.36.0" # Change to the release version you are generating. make semconv-generate # Uses the exported TAG. ```