Skip to content

Commit

Permalink
Merge pull request #3 from swiatekm-sumo/ci/automate-release
Browse files Browse the repository at this point in the history
Ci/automate release
  • Loading branch information
swiatekm authored Feb 27, 2024
2 parents d44f71d + cf05448 commit 8edb39c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 30 deletions.
10 changes: 7 additions & 3 deletions .ci/create-release-github.sh
Original file line number Diff line number Diff line change
@@ -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'
21 changes: 21 additions & 0 deletions .github/workflows/publish-operator-hub.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
52 changes: 27 additions & 25 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
3 changes: 1 addition & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8edb39c

Please sign in to comment.