diff --git a/.ci/create-release-github.sh b/.ci/create-release-github.sh index 8557ed7e75..10038569cd 100755 --- a/.ci/create-release-github.sh +++ b/.ci/create-release-github.sh @@ -1,9 +1,13 @@ #!/bin/bash -OPERATOR_VERSION=$(git describe --tags) +NOTES_FILE=/tmp/notes.md +# Note: Changelog headers don't have the `v` prefix, so we need to drop the first letter in the sed expression below +sed -n "/${DESIRED_VERSION:1}/,/${CURRENT_VERSION:1}/{/${CURRENT_VERSION:1}/!p;}" CHANGELOG.md >${NOTES_FILE} gh config set prompt disabled gh release create \ - -t "Release ${OPERATOR_VERSION}" \ - "${OPERATOR_VERSION}" \ + -t "Release ${DESIRED_VERSION}" \ + --notes-file ${NOTES_FILE} \ + --draft \ + "${DESIRED_VERSION}" \ 'dist/opentelemetry-operator.yaml#Installation manifest for Kubernetes' diff --git a/.github/workflows/publish-operator-hub.yaml b/.github/workflows/publish-operator-hub.yaml new file mode 100644 index 0000000000..bae29514e2 --- /dev/null +++ b/.github/workflows/publish-operator-hub.yaml @@ -0,0 +1,21 @@ +name: "Publish release on operator hub" +on: + release: + types: [published] + +jobs: + operator-hub-prod-release: + uses: ./.github/workflows/reusable-operator-hub-release.yaml + with: + org: redhat-openshift-ecosystem + repo: community-operators-prod + secrets: + OPENTELEMETRYBOT_GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + + operator-hub-community-release: + uses: ./.github/workflows/reusable-operator-hub-release.yaml + with: + org: k8s-operatorhub + repo: community-operators + secrets: + OPENTELEMETRYBOT_GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 735c6bf4be..ad46612e60 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,21 +1,42 @@ -name: "Prepare the release" +name: "Create the release" on: push: - tags: [ 'v*' ] + branches: + - 'release/**' + - 'main' + paths: + - 'versions.txt' jobs: + get-versions: + runs-on: ubuntu-22.04 + outputs: + current_version: ${{ steps.get-versions.outputs.current_version }} + desired_version: ${{ steps.get-versions.outputs.desired_version }} + steps: + - name: "Get versions from versions.txt" + id: get-versions + run: | + echo "desired_version=$(grep -v '#' versions.txt | grep operator= | awk -F= '{print $2}')" >> $GITHUB_OUTPUT + echo "current_version=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + release: runs-on: ubuntu-22.04 + needs: get-versions + if: needs.get-versions.outputs.desired_version != needs.get-versions.outputs.current_version + env: + CURRENT_VERSION: ${{ needs.get-versions.outputs.current_version }} + DESIRED_VERSION: ${{ needs.get-versions.outputs.desired_version }} steps: + - uses: actions/checkout@v4 + - name: Set up Go uses: actions/setup-go@v5 with: go-version: "~1.21.1" - - uses: actions/checkout@v4 - - name: "generate release resources" - run: make release-artifacts IMG_PREFIX="ghcr.io/open-telemetry/opentelemetry-operator" + run: make release-artifacts IMG_PREFIX="ghcr.io/open-telemetry/opentelemetry-operator" VERSION=${DESIRED_VERSION} - name: "create the release in GitHub" env: @@ -24,23 +45,4 @@ jobs: - name: "refresh go proxy module info on release" run: | - OPERATOR_VERSION=$(git describe --tags) - curl https://proxy.golang.org/github.com/open-telemetry/opentelemetry-operator/@v/${OPERATOR_VERSION}.info - - operator-hub-prod-release: - needs: release - uses: ./.github/workflows/reusable-operator-hub-release.yaml - with: - org: redhat-openshift-ecosystem - repo: community-operators-prod - secrets: - OPENTELEMETRYBOT_GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} - - operator-hub-community-release: - needs: release - uses: ./.github/workflows/reusable-operator-hub-release.yaml - with: - org: k8s-operatorhub - repo: community-operators - secrets: - OPENTELEMETRYBOT_GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }} + curl https://proxy.golang.org/github.com/open-telemetry/opentelemetry-operator/@v/${DESIRED_VERSION}.info diff --git a/RELEASE.md b/RELEASE.md index c8d0456a12..4ce905a4e9 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -15,8 +15,7 @@ Steps to release a new version of the OpenTelemetry Operator: 3. Update release schedule table, by moving the current release manager to the end of the table with updated release version. 3. Add the changes to the changelog by running `make chlog-update VERSION=$VERSION`. 3. Check the OpenTelemetry Collector's changelog and ensure migration steps are present in `pkg/collector/upgrade` -3. Once the changes above are merged and available in `main`, one of the maintainers will tag the release. -3. The GitHub Workflow will take it from here, creating a GitHub release with the generated artifacts (manifests) and publishing the images. +3. Once the changes above are merged and available in `main`, a draft release will be automatically created. Publish it once the release workflows all complete. 3. Update the operator version in the Helm Chart, as per the [release guide](https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-operator/CONTRIBUTING.md) 3. The GitHub Workflow, submits two pull requests to the Operator hub repositories. Make sure the pull requests are approved and merged. - `community-operators-prod` is used by OLM on OpenShift. Example: [`operator-framework/community-operators-prod`](https://github.com/redhat-openshift-ecosystem/community-operators-prod/pull/494)