Skip to content

Commit dbf0865

Browse files
authored
1 parent 8f71244 commit dbf0865

4 files changed

Lines changed: 19 additions & 13 deletions

File tree

.github/scripts/generate-release-contributors.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
# shellcheck disable=SC2016
44
# shellcheck disable=SC2086
55

6+
# this should be run on the release branch
7+
68
from_version=$1
7-
to_version=$2
89

9-
# get the date of the first commit on main that wasn't in the from_version
10+
# get the date of the first commit that was not in the from_version
1011
from=$(git log --reverse --pretty=format:"%cI" $from_version..HEAD | head -1)
1112

12-
# get the last commit on main that was in the to_version
13-
to=$(git merge-base HEAD $to_version | xargs git log -1 --pretty=format:"%cI")
13+
# get the last commit on main that was included in the release
14+
to=$(git merge-base origin/main HEAD | xargs git log -1 --pretty=format:"%cI")
1415

1516
contributors1=$(gh api graphql --paginate -F q="repo:$GITHUB_REPOSITORY is:pr base:main is:merged merged:$from..$to" -f query='
1617
query($q: String!, $endCursor: String) {
@@ -66,7 +67,7 @@ query($q: String!, $endCursor: String) {
6667
}
6768
}
6869
' --jq '.data.search.edges.[].node.body' \
69-
| grep -oE "#[0-9]{4,}|issues/[0-9]{4,}" \
70+
| grep -oE "#[0-9]{4,}|$GITHUB_REPOSITORY/issues/[0-9]{4,}" \
7071
| grep -oE "[0-9]{4,}" \
7172
| xargs -I{} gh issue view {} --json 'author,url' --jq '[.author.login,.url]' \
7273
| grep -v '/pull/' \

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ jobs:
6666
EOF
6767
fi
6868
69+
# the last complex regex is needed because markdown docs render newlines as soft wraps
70+
# while release notes render them as line breaks
6971
sed -n "/^## Version $VERSION/,/^## Version /p" CHANGELOG.md \
7072
| tail -n +2 \
7173
| head -n -1 \
7274
| perl -0pe 's/^\n+//g' \
7375
| perl -0pe 's/\n+$/\n/g' \
7476
| sed -r "s,\[#([0-9]+)]\(https://github.com/$GITHUB_REPOSITORY/(pull|issues)/[0-9]+\),#\1," \
75-
| perl -0pe 's/\n +/ /g' \
77+
| perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' \
7678
>> release-notes.txt
7779
7880
# conditional block not indented because of the heredoc
@@ -84,7 +86,7 @@ jobs:
8486
8587
EOF
8688
87-
.github/scripts/generate-release-contributors.sh v$PRIOR_VERSION $GITHUB_REF_NAME >> release-notes.txt
89+
.github/scripts/generate-release-contributors.sh v$PRIOR_VERSION >> release-notes.txt
8890
fi
8991
9092
- name: Create GitHub release

RELEASING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ In general, patch releases are only made for regressions, memory leaks and deadl
3333
* Review and merge the backport pull request that it generates.
3434
* Merge a pull request to the release branch updating the `CHANGELOG.md`.
3535
* The heading for the release should include the release version but not the release date, e.g.
36-
`## Version 1.9.0 (unreleased)`.
36+
`## Version 1.9.1 (unreleased)`.
3737
* Run the [Prepare patch release workflow](https://github.com/open-telemetry/opentelemetry-java/actions/workflows/prepare-patch-release.yml).
3838
* Press the "Run workflow" button, then select the release branch from the dropdown list,
3939
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.

docs/common-github-actions-practices.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ Here's some sample `RELEASING.md` documentation that goes with the automation be
397397
* Review and merge the backport pull request that it generates.
398398
* Merge a pull request to the release branch updating the `CHANGELOG.md`.
399399
* The heading for the release should include the release version but not the release date, e.g.
400-
`## Version 1.9.0 (unreleased)`.
400+
`## Version 1.9.1 (unreleased)`.
401401
* Run the [Prepare patch release workflow](https://github.com/open-telemetry/TODO/actions/workflows/prepare-patch-release.yml).
402402
* Press the "Run workflow" button, then select the release branch from the dropdown list,
403403
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
@@ -682,14 +682,17 @@ jobs:
682682
EOF
683683
fi
684684
685-
# TODO this is dependent on the conventions you follow in your CHANGELOG.md
685+
# TODO the initial sed range match is dependent on the your CHANGELOG.md format
686+
687+
# the last complex regex is needed because markdown docs render newlines as soft wraps
688+
# while release notes render them as line breaks
686689
sed -n "/^## Version $VERSION/,/^## Version /p" CHANGELOG.md \
687690
| tail -n +2 \
688691
| head -n -1 \
689692
| perl -0pe 's/^\n+//g' \
690693
| perl -0pe 's/\n+$/\n/g' \
691694
| sed -r "s,\[#([0-9]+)]\(https://github.com/$GITHUB_REPOSITORY/(pull|issues)/[0-9]+\),#\1," \
692-
| perl -0pe 's/\n +/ /g' \
695+
| perl -0pe 's/(?<!\n)\n *(?!\n)(?![-*] )(?![1-9]+\. )/ /g' \
693696
>> release-notes.txt
694697
```
695698

@@ -749,8 +752,8 @@ For example to send a PR to notify/update another repository that a new release
749752
as part of the release workflow.
750753

751754
Note that the Personal Access Token used will need `workflow` (Update GitHub Action workflows)
752-
permission since it will be updating the workflows of the origin repository when it pushes the
753-
branch and workflows have been updated upstream.
755+
permission since if workflows have been updated upstream it will be updating the workflows of the
756+
origin repository when it pushes the branch.
754757

755758
```yaml
756759
- uses: actions/checkout@v3

0 commit comments

Comments
 (0)