-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Workflow cleanup/sync * more * more * more * fix * consistency * Use simpler sharing of env vars across steps * Simplify, merge related jobs * Simplify * More improvements * Use release/* release branch naming
- Loading branch information
Showing
7 changed files
with
51 additions
and
85 deletions.
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Backport a pull request | ||
name: Backport | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
|
@@ -15,7 +15,7 @@ jobs: | |
# history is needed in order to do cherry-pick | ||
fetch-depth: 0 | ||
|
||
- name: Set up git name | ||
- name: Set git user | ||
run: | | ||
git config user.name opentelemetry-java-bot | ||
git config user.email [email protected] | ||
|
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
push: | ||
branches: | ||
- main | ||
- v[0-9]+.[0-9]+.x | ||
- release/* | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
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 |
---|---|---|
|
@@ -8,8 +8,7 @@ jobs: | |
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set versions | ||
id: set-versions | ||
- name: Set environment variables | ||
run: | | ||
prior_version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1) | ||
if [[ $prior_version =~ ([0-9]+.[0-9]+).([0-9]+) ]]; then | ||
|
@@ -19,37 +18,30 @@ jobs: | |
echo "unexpected version: $prior_version" | ||
exit 1 | ||
fi | ||
echo "::set-output name=release-version::$major_minor.$((patch + 1))" | ||
echo "::set-output name=prior-release-version::$prior_version" | ||
echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV | ||
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV | ||
- name: Bump version | ||
env: | ||
VERSION: ${{ steps.set-versions.outputs.release-version }} | ||
PRIOR_VERSION: ${{ steps.set-versions.outputs.prior-release-version }} | ||
run: | | ||
.github/scripts/update-versions.sh "$PRIOR_VERSION" "$PRIOR_VERSION-alpha" "$VERSION" "$VERSION-alpha" | ||
- name: Bump download link version | ||
env: | ||
VERSION: ${{ steps.set-versions.outputs.release-version }} | ||
PRIOR_VERSION: ${{ steps.set-versions.outputs.prior-release-version }} | ||
run: | | ||
sed -Ei "s,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$PRIOR_VERSION/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$VERSION/," README.md | ||
- name: Set up git name | ||
- name: Set git user | ||
run: | | ||
git config user.name opentelemetry-java-bot | ||
git config user.email [email protected] | ||
- name: Create pull request | ||
env: | ||
VERSION: ${{ steps.set-versions.outputs.release-version }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
msg="Prepare patch release $VERSION" | ||
msg="Prepare release $VERSION" | ||
git commit -a -m "$msg" | ||
git push origin HEAD:prepare-patch-release-$VERSION | ||
gh pr create --title "$msg" \ | ||
git push origin HEAD:prepare-release-$VERSION | ||
gh pr create --title "[$GITHUB_REF_NAME] $msg" \ | ||
--body "$msg" \ | ||
--head prepare-patch-release-$VERSION \ | ||
--head prepare-release-$VERSION \ | ||
--base $GITHUB_REF_NAME |
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 |
---|---|---|
|
@@ -3,67 +3,48 @@ on: | |
workflow_dispatch: | ||
|
||
jobs: | ||
prepare-release-branch: | ||
create-pull-request-against-release-branch: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release-branch-name: ${{ steps.set-release-branch-name.outputs.release-branch-name }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set release branch name | ||
id: set-release-branch-name | ||
run: | | ||
version=$(grep -Eo "[0-9.]+-SNAPSHOT" version.gradle.kts) | ||
release_branch_name=$(echo $version | sed -E 's/([0-9]+)\.([0-9]+)\.0/v\1.\2.x/') | ||
echo "::set-output name=release-branch-name::$release_branch_name" | ||
- name: Create release branch | ||
env: | ||
RELEASE_BRANCH_NAME: ${{ steps.set-release-branch-name.outputs.release-branch-name }} | ||
id: create-release-branch | ||
run: | | ||
git checkout -b $RELEASE_BRANCH_NAME | ||
git push origin $RELEASE_BRANCH_NAME | ||
version=$(grep -Eo "[0-9]+.[0-9]+.0-SNAPSHOT" version.gradle.kts | sed 's/-SNAPSHOT//') | ||
release_branch_name=$(echo $version | sed -E 's,([0-9]+)\.([0-9]+)\.0,release/v\1.\2.x,') | ||
create-pull-request-against-release-branch: | ||
needs: prepare-release-branch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ needs.prepare-release-branch.outputs.release-branch-name }} | ||
git push origin HEAD:$release_branch_name | ||
- name: Bump version on release branch | ||
echo "VERSION=$version" >> $GITHUB_ENV | ||
echo "RELEASE_BRANCH_NAME=$release_branch_name" >> $GITHUB_ENV | ||
- name: Bump version | ||
run: | | ||
version=$(grep -Eo "[0-9]+.[0-9]+.0-SNAPSHOT" version.gradle.kts | sed 's/-SNAPSHOT//') | ||
.github/scripts/update-versions.sh "$version-SNAPSHOT" "$version-alpha-SNAPSHOT" "$version" "$version-alpha" | ||
.github/scripts/update-versions.sh "$VERSION-SNAPSHOT" "$VERSION-alpha-SNAPSHOT" "$VERSION" "$VERSION-alpha" | ||
- name: Bump download link version | ||
run: | | ||
new_version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts | head -1) | ||
sed -Ei "s,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$new_version/," README.md | ||
sed -Ei "s,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$VERSION/," README.md | ||
- name: Set up git name | ||
- name: Set git user | ||
run: | | ||
git config user.name opentelemetry-java-bot | ||
git config user.email [email protected] | ||
- name: Create pull request against release branch | ||
env: | ||
RELEASE_BRANCH_NAME: ${{ needs.prepare-release-branch.outputs.release-branch-name }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
msg="Prepare release branch $RELEASE_BRANCH_NAME" | ||
msg="Prepare release $VERSION" | ||
git commit -a -m "$msg" | ||
git push origin HEAD:prepare-release-branch-$RELEASE_BRANCH_NAME | ||
gh pr create --title "$msg" \ | ||
git push origin HEAD:prepare-release-$VERSION | ||
gh pr create --title "[$RELEASE_BRANCH_NAME] $msg" \ | ||
--body "$msg" \ | ||
--head prepare-release-branch-$RELEASE_BRANCH_NAME \ | ||
--head prepare-release-$VERSION \ | ||
--base $RELEASE_BRANCH_NAME | ||
create-pull-request-against-main: | ||
needs: | ||
- prepare-release-branch | ||
- create-pull-request-against-release-branch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
@@ -81,7 +62,7 @@ jobs: | |
next_version="$major.$((minor + 1)).0" | ||
.github/scripts/update-versions.sh "$version-SNAPSHOT" "$version-alpha-SNAPSHOT" "$next_version-SNAPSHOT" "$next_version-alpha-SNAPSHOT" | ||
- name: Set up git name | ||
- name: Set git user | ||
run: | | ||
git config user.name opentelemetry-java-bot | ||
git config user.email [email protected] | ||
|
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 |
---|---|---|
|
@@ -71,8 +71,7 @@ jobs: | |
arguments: build publishPlugins publishPluginMavenPublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository | ||
build-root-directory: gradle-plugins | ||
|
||
- name: Set versions | ||
id: set-versions | ||
- name: Set environment variables | ||
run: | | ||
version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1) | ||
if [[ $version =~ ([0-9]+).([0-9]+).([0-9]+) ]]; then | ||
|
@@ -94,52 +93,49 @@ jobs: | |
else | ||
prior_version="$major.$minor.$((patch - 1))" | ||
fi | ||
echo "::set-output name=release-version::$version" | ||
echo "::set-output name=prior-release-version::$prior_version" | ||
echo "VERSION=$version" >> $GITHUB_ENV | ||
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV | ||
- name: Generate release notes | ||
env: | ||
VERSION: ${{ steps.set-versions.outputs.release-version }} | ||
PRIOR_VERSION: ${{ steps.set-versions.outputs.prior-release-version }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
if [[ $version == *.0 ]]; then | ||
cat > release-notes.txt << EOF | ||
This release targets the OpenTelemetry SDK $VERSION. | ||
Note that all artifacts other than \`io.opentelemetry.javaagent:opentelemetry-javaagent\` have the \`-alpha\` suffix attached to their version number, reflecting that they are still alpha quality and will continue to have breaking changes. Please see the [VERSIONING.md](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/VERSIONING.md#opentelemetry-java-instrumentation-versioning) for more details. | ||
EOF | ||
else | ||
cat > release-notes.txt << EOF | ||
This is a patch release on the previous $PRIOR_VERSION release, fixing the issue(s) below. | ||
EOF | ||
fi | ||
sed -n '/^## Version $VERSION/,/^## Version /p' CHANGELOG.md \ | ||
sed -n "/^## Version $VERSION/,/^## Version /p" CHANGELOG.md \ | ||
| tail -n +2 \ | ||
| head -n -1 \ | ||
| perl -0pe 's/^\n+//g' \ | ||
| perl -0pe 's/\n+$/\n/g' \ | ||
| sed -r 's,\[#([0-9]+)]\(https://github.com/$GITHUB_REPOSITORY/(pull|issues)/[0-9]+\),#\1,' \ | ||
| sed -r "s,\[#([0-9]+)]\(https://github.com/$GITHUB_REPOSITORY/(pull|issues)/[0-9]+\),#\1," \ | ||
| perl -0pe 's/\n +/ /g' \ | ||
>> release-notes.txt | ||
if [[ $version == *.0 ]]; then | ||
cat >> release-notes.txt << EOF | ||
### 🙇 Thank you | ||
This release was possible thanks to the following contributors who shared their brilliant ideas and awesome pull requests: | ||
EOF | ||
.github/scripts/generate-release-contributors.sh v$PRIOR_VERSION v$VERSION >> release-notes.txt | ||
fi | ||
- name: Create GitHub release | ||
env: | ||
VERSION: ${{ steps.set-versions.outputs.release-version }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
cp javaagent/build/libs/opentelemetry-javaagent-$VERSION.jar opentelemetry-javaagent.jar | ||
|
@@ -157,27 +153,22 @@ jobs: | |
token: ${{ secrets.OPENTELEMETRY_JAVA_BOT_TOKEN }} | ||
|
||
- name: Initialize pull request branch | ||
env: | ||
VERSION: ${{ steps.set-versions.outputs.release-version }} | ||
run: | | ||
git remote add upstream https://github.com/open-telemetry/opentelemetry-operator.git | ||
git fetch upstream | ||
git checkout -b update-opentelemetry-javaagent-to-$VERSION upstream/main | ||
- name: Bump version | ||
env: | ||
VERSION: ${{ steps.set-versions.outputs.release-version }} | ||
run: | | ||
echo $VERSION > autoinstrumentation/java/version.txt | ||
- name: Set up git name | ||
- name: Set git user | ||
run: | | ||
git config user.name opentelemetry-java-bot | ||
git config user.email [email protected] | ||
- name: Create pull request against opentelemetry-operator | ||
env: | ||
VERSION: ${{ steps.set-versions.outputs.release-version }} | ||
# this is the PAT used for "gh pr create" below | ||
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRY_JAVA_BOT_TOKEN }} | ||
run: | | ||
|
@@ -193,19 +184,21 @@ jobs: | |
gh pr create --title "$msg" \ | ||
--body "$msg" \ | ||
--repo open-telemetry/opentelemetry-operator | ||
--base main | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
# history is needed in order to run git format-patch below | ||
fetch-depth: 0 | ||
|
||
- name: Set up git name | ||
- name: Set git user | ||
run: | | ||
git config user.name opentelemetry-java-bot | ||
git config user.email [email protected] | ||
# this step should be last since it will fail if conflicting change log updates on main | ||
# this step should be last since it will fail if there have been conflicting | ||
# change log updates introduced on the main branch | ||
- name: Create pull request to merge any change log updates to main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -215,9 +208,9 @@ jobs: | |
git apply patch | ||
msg="Merge change log updates from $GITHUB_REF_NAME to main" | ||
git commit -a -m "$msg" | ||
git push origin HEAD:opentelemetry-java-bot/merge-change-log-updates | ||
git push origin HEAD:merge-change-log-updates-to-main | ||
gh pr create --title "$msg" \ | ||
--body "$msg" \ | ||
--head opentelemetry-java-bot/merge-change-log-updates \ | ||
--head merge-change-log-updates-to-main \ | ||
--base main | ||
fi |
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