Skip to content

Commit

Permalink
Release workflow improvement (#4353)
Browse files Browse the repository at this point in the history
* heading format

* Remove separators

* workflow

* updates

* Include note about release heading

* fix link
  • Loading branch information
trask authored Apr 8, 2022
1 parent d0357cb commit e33411c
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
# history is needed in order to do cherry-pick
# history is needed to run git cherry-pick below
fetch-depth: 0

- name: Set git user
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/merge-change-log-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Merge change log to main
on:
workflow_dispatch:

jobs:
create-pull-request:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
ref: main
# history is needed to run format-patch below
fetch-depth: 0

- name: Set git user
run: |
git config user.name opentelemetry-java-bot
git config user.email [email protected]
# this will fail if there have been conflicting change log updates introduced in main
- name: Create pull request against main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git format-patch --stdout main..$GITHUB_REF_NAME CHANGELOG.md | git apply
msg="Merge change log updates from $GITHUB_REF_NAME to main"
git commit -a -m "$msg"
git push origin HEAD:merge-change-log-updates-to-main
gh pr create --title "$msg" \
--body "$msg" \
--head merge-change-log-updates-to-main \
--base main
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
git config user.name opentelemetry-java-bot
git config user.email [email protected]
- name: Create pull request against release branch
- name: Create pull request against the release branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
31 changes: 12 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,31 +95,24 @@ jobs:
--discussion-category announcements \
v$VERSION
- uses: actions/checkout@v3
with:
ref: main
# history is needed in order to generate the patch
fetch-depth: 0
- name: Update the change log with the release date
run: |
date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
sed -ri "s/## Version $VERSION .*/## Version $VERSION ($date)/" CHANGELOG.md
- 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 there have been conflicting
# change log updates introduced on the main branch
- name: Create pull request to merge any change log updates to main
- name: Create pull request against the release branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git format-patch --stdout main..$GITHUB_REF_NAME CHANGELOG.md > patch
if [ -s patch ]; then
git apply patch
msg="Merge change log updates from $GITHUB_REF_NAME to main"
git commit -a -m "$msg"
git push origin HEAD:merge-change-log-updates-to-main
gh pr create --title "$msg" \
--body "$msg" \
--head merge-change-log-updates-to-main \
--base main
fi
msg="Add $VERSION release date to the change log"
git commit -a -m "$msg"
git push origin HEAD:add-$VERSION-release-date
gh pr create --title "[$GITHUB_REF_NAME] $msg" \
--body "$msg" \
--head add-$VERSION-release-date \
--base $GITHUB_REF_NAME
Loading

0 comments on commit e33411c

Please sign in to comment.