|
@@ -38,7 +38,7 @@ jobs:
|
|
steps:
|
|
steps:
|
|
- run: |
|
|
- run: |
|
|
if [[ $GITHUB_REF_NAME != release/* ]]; then
|
|
if [[ $GITHUB_REF_NAME != release/* ]]; then
|
|
- echo the release workflow should only be run against release branches
|
|
|
|
|
|
+ echo this workflow should only be run against release branches
|
|
exit 1
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
|
|
@@ -79,7 +79,7 @@ jobs:
|
|
- name: Set environment variables
|
|
- name: Set environment variables
|
|
run: |
|
|
run: |
|
|
version=$(.github/scripts/get-version.sh)
|
|
version=$(.github/scripts/get-version.sh)
|
|
- if [[ $version =~ ([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
|
|
|
|
|
|
+ if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
|
|
major="${BASH_REMATCH[1]}"
|
|
major="${BASH_REMATCH[1]}"
|
|
minor="${BASH_REMATCH[2]}"
|
|
minor="${BASH_REMATCH[2]}"
|
|
patch="${BASH_REMATCH[3]}"
|
|
patch="${BASH_REMATCH[3]}"
|
|
@@ -101,41 +101,63 @@ jobs:
|
|
echo "VERSION=$version" >> $GITHUB_ENV
|
|
echo "VERSION=$version" >> $GITHUB_ENV
|
|
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV
|
|
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
+ # check out main branch to verify there won't be problems with merging the change log
|
|
|
|
+ # at the end of this workflow
|
|
|
|
+ - uses: actions/checkout@v3
|
|
|
|
+ with:
|
|
|
|
+ ref: main
|
|
|
|
+
|
|
|
|
+ - run: |
|
|
|
|
+ if [[ $VERSION == *.0 ]]; then
|
|
|
|
+ # not making a patch release
|
|
|
|
+ if ! grep --quiet "^## Version $VERSION " CHANGELOG.md; then
|
|
|
|
+ echo the pull request generated by prepare-release-branch.yml needs to be merged first
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
+
|
|
|
|
+ # back to the release branch
|
|
|
|
+ - uses: actions/checkout@v3
|
|
|
|
+
|
|
- name: Generate release notes
|
|
- name: Generate release notes
|
|
env:
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
run: |
|
|
# conditional blocks not indented because of the heredoc
|
|
# conditional blocks not indented because of the heredoc
|
|
if [[ $VERSION == *.0 ]]; then
|
|
if [[ $VERSION == *.0 ]]; then
|
|
- cat > release-notes.txt << EOF
|
|
|
|
|
|
+ cat > /tmp/release-notes.txt << EOF
|
|
This release targets the OpenTelemetry SDK $VERSION.
|
|
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.
|
|
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
|
|
EOF
|
|
else
|
|
else
|
|
- cat > release-notes.txt << EOF
|
|
|
|
|
|
+ cat > /tmp/release-notes.txt << EOF
|
|
This is a patch release on the previous $PRIOR_VERSION release, fixing the issue(s) below.
|
|
This is a patch release on the previous $PRIOR_VERSION release, fixing the issue(s) below.
|
|
|
|
|
|
EOF
|
|
EOF
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
+ # CHANGELOG_SECTION.md is also used at the end of the release workflow
|
|
|
|
+ # for copying the change log updates to main
|
|
|
|
+ sed -n "0,/^## Version $VERSION /d;/^## Version /q;p" CHANGELOG.md \
|
|
|
|
+ > /tmp/CHANGELOG_SECTION.md
|
|
|
|
+
|
|
# the complex perl regex is needed because markdown docs render newlines as soft wraps
|
|
# the complex perl regex is needed because markdown docs render newlines as soft wraps
|
|
# while release notes render them as line breaks
|
|
# while release notes render them as line breaks
|
|
- sed -n "0,/^## Version $VERSION/d;/^## Version /q;p" CHANGELOG.md \
|
|
|
|
- | perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' \
|
|
|
|
- >> release-notes.txt
|
|
|
|
|
|
+ perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' /tmp/CHANGELOG_SECTION.md \
|
|
|
|
+ >> /tmp/release-notes.txt
|
|
|
|
|
|
# conditional block not indented because of the heredoc
|
|
# conditional block not indented because of the heredoc
|
|
if [[ $VERSION == *.0 ]]; then
|
|
if [[ $VERSION == *.0 ]]; then
|
|
- cat >> release-notes.txt << EOF
|
|
|
|
|
|
+ cat >> /tmp/release-notes.txt << EOF
|
|
|
|
|
|
### 🙇 Thank you
|
|
### 🙇 Thank you
|
|
This release was possible thanks to the following contributors who shared their brilliant ideas and awesome pull requests:
|
|
This release was possible thanks to the following contributors who shared their brilliant ideas and awesome pull requests:
|
|
|
|
|
|
EOF
|
|
EOF
|
|
|
|
|
|
- .github/scripts/generate-release-contributors.sh v$PRIOR_VERSION >> release-notes.txt
|
|
|
|
|
|
+ .github/scripts/generate-release-contributors.sh v$PRIOR_VERSION >> /tmp/release-notes.txt
|
|
fi
|
|
fi
|
|
|
|
|
|
- name: Create GitHub release
|
|
- name: Create GitHub release
|
|
@@ -145,35 +167,87 @@ jobs:
|
|
cp javaagent/build/libs/opentelemetry-javaagent-${VERSION}.jar opentelemetry-javaagent.jar
|
|
cp javaagent/build/libs/opentelemetry-javaagent-${VERSION}.jar opentelemetry-javaagent.jar
|
|
gh release create --target $GITHUB_REF_NAME \
|
|
gh release create --target $GITHUB_REF_NAME \
|
|
--title "Version $VERSION" \
|
|
--title "Version $VERSION" \
|
|
- --notes-file release-notes.txt \
|
|
|
|
|
|
+ --notes-file /tmp/release-notes.txt \
|
|
--discussion-category announcements \
|
|
--discussion-category announcements \
|
|
v$VERSION \
|
|
v$VERSION \
|
|
opentelemetry-javaagent.jar
|
|
opentelemetry-javaagent.jar
|
|
|
|
|
|
- - name: Update the change log with the release date
|
|
|
|
|
|
+ - uses: actions/checkout@v3
|
|
|
|
+ with:
|
|
|
|
+ # the step below is creating a pull request against main
|
|
|
|
+ ref: main
|
|
|
|
+
|
|
|
|
+ - name: Copy change log updates to main
|
|
env:
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
run: |
|
|
- date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
|
|
|
|
- sed -Ei "s/## Version $VERSION .*/## Version $VERSION ($date)/" CHANGELOG.md
|
|
|
|
|
|
+ if [[ $VERSION == *.0 ]]; then
|
|
|
|
+ # this was not a patch release, so the version exists already in the CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # update the release date
|
|
|
|
+ date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
|
|
|
|
+ sed -Ei "s/## Version $VERSION .*/## Version $VERSION ($date)/" CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # the entries are copied over from the release branch to support workflows
|
|
|
|
+ # where change log entries may be updated after preparing the release branch
|
|
|
|
+
|
|
|
|
+ # copy the portion above the release, up to and including the heading
|
|
|
|
+ sed -n "0,/^## Version $VERSION ($date)/p" CHANGELOG.md > /tmp/CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # copy the release notes
|
|
|
|
+ cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # copy the portion below the release
|
|
|
|
+ sed -n "0,/^## Version $VERSION /d;0,/^## Version /{/^## Version/!d};p" CHANGELOG.md \
|
|
|
|
+ >> /tmp/CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # update the real CHANGELOG.md
|
|
|
|
+ cp /tmp/CHANGELOG.md CHANGELOG.md
|
|
|
|
+ else
|
|
|
|
+ # this was a patch release, so the version does not exist already in the CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # copy the portion above the top-most release, not including the heading
|
|
|
|
+ sed -n "0,/^## Version /{ /^## Version /!p }" CHANGELOG.md > /tmp/CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # add the heading
|
|
|
|
+ date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
|
|
|
|
+ echo "## Version $VERSION ($date)" >> /tmp/CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # copy the release notes
|
|
|
|
+ cat /tmp/CHANGELOG_SECTION.md >> /tmp/CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # copy the portion starting from the top-most release
|
|
|
|
+ sed -n "/^## Version /,\$p" CHANGELOG.md >> /tmp/CHANGELOG.md
|
|
|
|
+
|
|
|
|
+ # update the real CHANGELOG.md
|
|
|
|
+ cp /tmp/CHANGELOG.md CHANGELOG.md
|
|
|
|
+ fi
|
|
|
|
|
|
- name: Set git user
|
|
- name: Set git user
|
|
run: .github/scripts/set-git-user.sh
|
|
run: .github/scripts/set-git-user.sh
|
|
|
|
|
|
- - name: Create pull request against the release branch
|
|
|
|
|
|
+ - name: Create pull request against main
|
|
env:
|
|
env:
|
|
- # not using the default GITHUB_TOKEN because pull requests generated by it do not run any workflows
|
|
|
|
|
|
+ # not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
|
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
run: |
|
|
run: |
|
|
- message="Add the release date for $VERSION to the change log"
|
|
|
|
- branch="add-release-date-for-${VERSION}"
|
|
|
|
|
|
+ message="Copy change log updates from $GITHUB_REF_NAME"
|
|
|
|
+ body="Copy log updates from \`$GITHUB_REF_NAME\`."
|
|
|
|
+ branch="copy-change-log-updates-from-${GITHUB_REF_NAME//\//-}"
|
|
|
|
+
|
|
|
|
+ if [[ $VERSION == *.0 ]]; then
|
|
|
|
+ if git diff --quiet; then
|
|
|
|
+ echo there are no updates needed to the change log on main, not creating pull request
|
|
|
|
+ exit 0 # success
|
|
|
|
+ fi
|
|
|
|
+ fi
|
|
|
|
|
|
git commit -a -m "$message"
|
|
git commit -a -m "$message"
|
|
git push origin HEAD:$branch
|
|
git push origin HEAD:$branch
|
|
- gh pr create --title "[$GITHUB_REF_NAME] $message" \
|
|
|
|
- --body "$message." \
|
|
|
|
|
|
+ gh pr create --title "$message" \
|
|
|
|
+ --body "$body" \
|
|
--head $branch \
|
|
--head $branch \
|
|
- --base $GITHUB_REF_NAME
|
|
|
|
|
|
+ --base main
|
|
|
|
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
with:
|