-
Notifications
You must be signed in to change notification settings - Fork 886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add workflow to prepare release branch #5143
Merged
trask
merged 6 commits into
open-telemetry:main
from
trask:workflow-to-prepare-release-branch
Jan 18, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b2e58f3
Add workflow to prepare release branch
trask a240095
Merge remote-tracking branch 'upstream/main' into workflow-to-prepare…
trask 5d1ed37
Avoid third party action
trask 6f0c1b1
Use PAT
trask e98e66d
Delete the branches
trask bde4be7
Revert "Use PAT"
trask File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# Bumps versions in these files | ||
# - version.gradle.kts | ||
# - examples/distro/build.gradle | ||
# - examples/extension/build.gradle | ||
|
||
current_version=$1 | ||
current_alpha_version=$2 | ||
new_version=$3 | ||
new_alpha_version=$4 | ||
|
||
echo "updating from $current_version to $new_version and from $current_alpha_version to $new_alpha_version" | ||
|
||
sed -ri "s/$current_version/$new_version/" version.gradle.kts | ||
sed -ri "s/$current_alpha_version/$new_alpha_version/" version.gradle.kts | ||
|
||
sed -ri "s/(opentelemetryJavaagent *: \")$current_version/\1$new_version/" examples/distro/build.gradle | ||
sed -ri "s/(opentelemetryJavaagentAlpha *: \")$current_alpha_version/\1$new_alpha_version/" examples/distro/build.gradle | ||
|
||
sed -ri "s/(opentelemetryJavaagent *: \")$current_version/\1$new_version/" examples/extension/build.gradle | ||
sed -ri "s/(opentelemetryJavaagentAlpha *: \")$current_alpha_version/\1$new_alpha_version/" examples/extension/build.gradle | ||
|
||
sed -ri "s/(io.opentelemetry.instrumentation.muzzle-generation\" version \")$current_alpha_version/\1$new_alpha_version/" examples/extension/build.gradle | ||
sed -ri "s/(io.opentelemetry.instrumentation.muzzle-check\" version \")$current_alpha_version/\1$new_alpha_version/" examples/extension/build.gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Prepare Release Branch | ||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
prepare-release-branch: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release-branch-name: ${{ steps.set-release-branch-name.outputs.release-branch-name }} | ||
steps: | ||
- uses: actions/checkout@v2.3.4 | ||
|
||
- name: Set release branch name | ||
id: set-release-branch-name | ||
run: | | ||
release_branch_name=$(grep -Eo "[0-9.]+-SNAPSHOT" version.gradle.kts | sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+)-SNAPSHOT/v\1.\2.x/') | ||
echo "::set-output name=release-branch-name::$release_branch_name" | ||
|
||
- name: Create release branch | ||
run: | | ||
git checkout -b ${{ steps.set-release-branch-name.outputs.release-branch-name }} | ||
git push origin ${{ steps.set-release-branch-name.outputs.release-branch-name }} | ||
|
||
create-pull-request-against-release-branch: | ||
needs: prepare-release-branch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2.3.4 | ||
with: | ||
ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }} | ||
|
||
- name: Remove SNAPSHOT from version | ||
run: | | ||
v=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+-SNAPSHOT" version.gradle.kts | sed 's/-SNAPSHOT//') | ||
.github/scripts/update-versions.sh "$v-SNAPSHOT" "$v-alpha-SNAPSHOT" "$v" "$v-alpha" | ||
|
||
- name: Bump download link version | ||
run: | | ||
new_version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1) | ||
sed -Ei "s,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v[0-9]+.[0-9]+.[0-9]+/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$new_version/," README.md | ||
|
||
- name: Setup git name | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
|
||
- name: Create pull request | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
msg="Prepare release branch ${{ needs.prepare-release-branch.outputs.release-branch-name }}" | ||
git add -u | ||
git commit -m "$msg" | ||
git push origin HEAD:prepare-release-branch-${{ needs.prepare-release-branch.outputs.release-branch-name }} | ||
gh pr create --title "$msg" \ | ||
--body "$msg" \ | ||
--head prepare-release-branch-${{ needs.prepare-release-branch.outputs.release-branch-name }} \ | ||
--base ${{ needs.prepare-release-branch.outputs.release-branch-name }} | ||
|
||
create-pull-request-against-main: | ||
needs: prepare-release-branch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2.3.4 | ||
|
||
- name: Bump SNAPSHOT version | ||
run: | | ||
v=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+-SNAPSHOT" version.gradle.kts | sed 's/-SNAPSHOT//') | ||
if [[ $v =~ ([0-9]+).([0-9]+).0 ]]; then | ||
major="${BASH_REMATCH[1]}" | ||
minor="${BASH_REMATCH[2]}" | ||
else | ||
echo "unexpected version: $v" | ||
exit 1 | ||
fi | ||
bump="$major.$((minor + 1)).0" | ||
.github/scripts/update-versions.sh "$v-SNAPSHOT" "$v-alpha-SNAPSHOT" "$bump-SNAPSHOT" "$bump-alpha-SNAPSHOT" | ||
|
||
- name: Setup git name | ||
run: | | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
|
||
- name: Create pull request | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
msg="Bump snapshot version" | ||
git add -u | ||
git commit -m "$msg" | ||
git push origin HEAD:bump-snapshot-version | ||
gh pr create --title "$msg" --body "$msg" --head bump-snapshot-version --base main | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,17 +14,9 @@ as the last step, which publishes a snapshot build to | |
Before making the release: | ||
|
||
* Merge a PR to `main` updating the `CHANGELOG.md` | ||
* Create a release branch, e.g. `v1.9.x` | ||
``` | ||
git checkout -b v1.9.x upstream/main | ||
git push upstream v1.9.x | ||
``` | ||
* Merge a PR to the release branch with the following changes | ||
* Remove `-SNAPSHOT` from the version in these files: | ||
* version.gradle.kts | ||
* examples/distro/build.gradle | ||
* examples/extension/build.gradle | ||
* Bump the version in the download link in the root `README.md` file | ||
* Run the [Prepare Release Branch workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/prepare-release-branch.yml). | ||
* Review and merge the two PRs that it creates (one is targeted to the release branch and one is targeted to the `main` branch) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure to delete the branch after merging |
||
* Delete the branches from these two PRs since they are created in the main repo | ||
|
||
Open the release build workflow in your browser [here](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/release-build.yml). | ||
|
||
|
@@ -40,11 +32,7 @@ and pushes a git tag with the version number. | |
|
||
After making the release: | ||
|
||
* Merge a PR to `main` with the following changes | ||
* Bump version in these files to the next `-SNAPSHOT` version (e.g. from `1.9.0-SNAPSHOT` to `1.10.0-SNAPSHOT`) | ||
* version.gradle.kts | ||
* examples/distro/build.gradle | ||
* examples/extension/build.gradle | ||
* Merge a PR to `main` with the following change | ||
* Bump the version in the download link in the root `README.md` file | ||
|
||
## Announcement | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed the
**/**
CNCF branch protection rule seems to be gone, did we accidentally delete it?Though either way, even if we can make it work for release branch, this PR creation to
main
looks like it'll be problematic due to CLA check :(There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though we do explicitly have the checkbox to let us merge even if status checks aren't all passing. So that could be our workaround
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have branch protection on both
main
andv**
, so CLA check will be a problem for both PRs 😞There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks there are complexities to approving github-actions bot account for EasyCLA and so that path could take some time
it seems that the current recommendation is to use a Personal Access Token generated by one of the maintainers: https://github.com/open-telemetry/community/blob/main/docs/using-github-extensions.md#writing-your-github-actions-pipelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted back to using github-actions bot for now at least