Skip to content

Commit 2655b58

Browse files
authored
ci: create release based on changes to versions.txt (open-telemetry#2688)
(cherry picked from commit 0a40eb4)
1 parent 4dff82a commit 2655b58

File tree

4 files changed

+57
-33
lines changed

4 files changed

+57
-33
lines changed

.ci/create-release-github.sh

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#!/bin/bash
22

33
NOTES_FILE=/tmp/notes.md
4-
OPERATOR_VERSION=$(git describe --tags --abbrev=0)
5-
PREVIOUS_OPERATOR_VERSION=$(git describe --tags --abbrev=0 "${OPERATOR_VERSION}^")
6-
# Note: Changelog headers don't have the `v` prefix, so we need to drop the first letter in the sed expression below
7-
sed -n "/${OPERATOR_VERSION:1}/,/${PREVIOUS_OPERATOR_VERSION:1}/{/${PREVIOUS_OPERATOR_VERSION:1}/!p;}" CHANGELOG.md >${NOTES_FILE}
4+
# Note: We expect the versions to not have the `v` prefix here
5+
sed -n "/${DESIRED_VERSION}/,/${CURRENT_VERSION}/{/${CURRENT_VERSION}/!p;}" CHANGELOG.md >${NOTES_FILE}
86

97
gh config set prompt disabled
108
gh release create \
11-
-t "Release ${OPERATOR_VERSION}" \
9+
-t "Release v${DESIRED_VERSION}" \
1210
--notes-file ${NOTES_FILE} \
13-
"${OPERATOR_VERSION}" \
11+
--draft \
12+
"v${DESIRED_VERSION}" \
1413
'dist/opentelemetry-operator.yaml#Installation manifest for Kubernetes'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Publish release on operator hub"
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
operator-hub-prod-release:
8+
uses: ./.github/workflows/reusable-operator-hub-release.yaml
9+
with:
10+
org: redhat-openshift-ecosystem
11+
repo: community-operators-prod
12+
secrets:
13+
OPENTELEMETRYBOT_GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
14+
15+
operator-hub-community-release:
16+
uses: ./.github/workflows/reusable-operator-hub-release.yaml
17+
with:
18+
org: k8s-operatorhub
19+
repo: community-operators
20+
secrets:
21+
OPENTELEMETRYBOT_GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}

.github/workflows/release.yaml

+30-25
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,45 @@
1-
name: "Prepare the release"
1+
name: "Create the release"
22
on:
33
push:
4-
tags: [ 'v*' ]
4+
branches:
5+
- 'release/**'
6+
- 'main'
7+
paths:
8+
- 'versions.txt'
59

610
jobs:
11+
get-versions:
12+
runs-on: ubuntu-22.04
13+
outputs:
14+
current_version: ${{ steps.get-versions.outputs.current_version }}
15+
desired_version: ${{ steps.get-versions.outputs.desired_version }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
- name: "Get versions from versions.txt"
21+
id: get-versions
22+
run: |
23+
echo "desired_version=$(grep -v '#' versions.txt | grep operator= | awk -F= '{print $2}')" >> $GITHUB_OUTPUT
24+
echo "current_version=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> $GITHUB_OUTPUT
25+
726
release:
827
runs-on: ubuntu-22.04
28+
needs: get-versions
29+
if: needs.get-versions.outputs.desired_version != needs.get-versions.outputs.current_version
30+
env:
31+
CURRENT_VERSION: ${{ needs.get-versions.outputs.current_version }}
32+
DESIRED_VERSION: ${{ needs.get-versions.outputs.desired_version }}
933
steps:
34+
- uses: actions/checkout@v4
35+
1036
- name: Set up Go
1137
uses: actions/setup-go@v5
1238
with:
1339
go-version: "~1.21.1"
1440

15-
- uses: actions/checkout@v4
16-
1741
- name: "generate release resources"
18-
run: make release-artifacts IMG_PREFIX="ghcr.io/open-telemetry/opentelemetry-operator"
42+
run: make release-artifacts IMG_PREFIX="ghcr.io/open-telemetry/opentelemetry-operator" VERSION=${DESIRED_VERSION}
1943

2044
- name: "create the release in GitHub"
2145
env:
@@ -24,23 +48,4 @@ jobs:
2448

2549
- name: "refresh go proxy module info on release"
2650
run: |
27-
OPERATOR_VERSION=$(git describe --tags)
28-
curl https://proxy.golang.org/github.com/open-telemetry/opentelemetry-operator/@v/${OPERATOR_VERSION}.info
29-
30-
operator-hub-prod-release:
31-
needs: release
32-
uses: ./.github/workflows/reusable-operator-hub-release.yaml
33-
with:
34-
org: redhat-openshift-ecosystem
35-
repo: community-operators-prod
36-
secrets:
37-
OPENTELEMETRYBOT_GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
38-
39-
operator-hub-community-release:
40-
needs: release
41-
uses: ./.github/workflows/reusable-operator-hub-release.yaml
42-
with:
43-
org: k8s-operatorhub
44-
repo: community-operators
45-
secrets:
46-
OPENTELEMETRYBOT_GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
51+
curl https://proxy.golang.org/github.com/open-telemetry/opentelemetry-operator/@v/${DESIRED_VERSION}.info

RELEASE.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ Steps to release a new version of the OpenTelemetry Operator:
1515
3. Update release schedule table, by moving the current release manager to the end of the table with updated release version.
1616
3. Add the changes to the changelog by running `make chlog-update VERSION=$VERSION`.
1717
3. Check the OpenTelemetry Collector's changelog and ensure migration steps are present in `pkg/collector/upgrade`
18-
3. Once the changes above are merged and available in `main`, one of the maintainers will tag the release.
19-
3. The GitHub Workflow will take it from here, creating a GitHub release with the generated artifacts (manifests) and publishing the images.
18+
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.
2019
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)
2120
3. The GitHub Workflow, submits two pull requests to the Operator hub repositories. Make sure the pull requests are approved and merged.
2221
- `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)

0 commit comments

Comments
 (0)