Skip to content

Commit

Permalink
[chore] add prepare-release action/script (#18057)
Browse files Browse the repository at this point in the history
This will reduce the amount of time spent releasing for maintainers.

Signed-off-by: Alex Boten <aboten@lightstep.com>
  • Loading branch information
Alex Boten authored Jan 26, 2023
1 parent 886eedd commit 8f42168
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Automation - Prepare Release

on:
workflow_dispatch:
# Determine the version number that will be assigned to the release. During the beta phase, we increment
# the minor version number and set the patch number to 0.
inputs:
candidate-beta:
required: true
description: Release candidate version (beta, like 0.70.0)

current-beta:
required: true
description: Current version (beta, like 0.69.1)
jobs:
# Releasing opentelemetry-collector-contrib
prepare-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: 'open-telemetry/opentelemetry-collector'
path: opentelemetry-collector
- uses: actions/checkout@v3
with:
path: opentelemetry-collector-contrib
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Prepare release for contrib
working-directory: opentelemetry-collector-contrib
env:
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
REPO: open-telemetry/opentelemetry-collector-contrib
CANDIDATE_BETA: ${{ inputs.candidate-beta }}
CURRENT_BETA: ${{ inputs.current-beta }}
run: ./.github/workflows/scripts/release-prepare-release.sh
35 changes: 35 additions & 0 deletions .github/workflows/scripts/release-prepare-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash -ex

make chlog-update VERSION="${CANDIDATE_BETA}"
git config user.name opentelemetrybot
git config user.email 107717825+opentelemetrybot@users.noreply.github.com

BRANCH="prepare-release-prs/${CANDIDATE_BETA}"
git checkout -b "${BRANCH}"
git add --all
git commit -m "changelog update ${CANDIDATE_BETA}"

sed -i.bak "s/${CURRENT_BETA}/${CANDIDATE_BETA}/g" versions.yaml
find . -name "*.bak" -type f -delete
git add versions.yaml
git commit -m "update version.yaml ${CANDIDATE_BETA}"

make multimod-prerelease
git add .
git commit -m "make multimod-prerelease changes ${CANDIDATE_BETA}" || (echo "no multimod changes to commit")

make multimod-sync
git add .
git commit -m "make multimod-sync changes ${CANDIDATE_BETA}" || (echo "no multimod changes to commit")

make otelcontribcol

git push origin "${BRANCH}"

gh pr create --title "[chore] Prepare release ${CANDIDATE_BETA}" --body "
The following commands were run to prepare this release:
- make chlog-update VERSION=${CANDIDATE_BETA}
- sed -i.bak s/${CURRENT_BETA}/${CANDIDATE_BETA}/g versions.yaml
- make multimod-prerelease
- make multimod-sync
"

0 comments on commit 8f42168

Please sign in to comment.