Skip to content

Commit f8bf3c4

Browse files
authored
Workflow updates and fixes (#286)
* Port open-telemetry/opentelemetry-java#4353 * Port open-telemetry/opentelemetry-java#4359 * Port open-telemetry/opentelemetry-java#4361 * Port open-telemetry/opentelemetry-java#4362 * More syncing * And sync markdown link check
1 parent fb2e956 commit f8bf3c4

11 files changed

+124
-63
lines changed

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

100644100755
File mode changed.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash -e
2+
3+
for file in "$@"; do
4+
for i in 1 2 3; do
5+
if markdown-link-check --config "$(dirname "$0")/markdown-link-check-config.json" \
6+
"$file"; then
7+
break
8+
elif [[ $i == 3 ]]; then
9+
exit 1
10+
fi
11+
sleep 5
12+
done
13+
done

.github/workflows/backport.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v3
1414
with:
15-
# history is needed in order to do cherry-pick
15+
# history is needed to run git cherry-pick below
1616
fetch-depth: 0
1717

1818
- name: Set git user

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ jobs:
7171
- build
7272
- integration-test
7373
runs-on: ubuntu-latest
74-
if: ${{ github.repository == 'open-telemetry/opentelemetry-java-contrib' }}
74+
# skipping release branches because the versions in those branches are not snapshots
75+
if: ${{ github.ref_name == 'main' && github.repository == 'open-telemetry/opentelemetry-java-contrib' }}
7576
steps:
7677
- uses: actions/checkout@v3
7778

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Merge change log to main
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
create-pull-request:
7+
runs-on: ubuntu-20.04
8+
steps:
9+
- uses: actions/checkout@v3
10+
with:
11+
# this workflow is run against the release branch (see usage of GITHUB_REF_NAME below)
12+
# but it is creating a pull request against main
13+
ref: main
14+
# history is needed to run format-patch below
15+
fetch-depth: 0
16+
17+
- name: Set git user
18+
run: |
19+
git config user.name opentelemetry-java-bot
20+
git config user.email [email protected]
21+
22+
# this will fail if there have been conflicting change log updates introduced in main
23+
- name: Create pull request against main
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
run: |
27+
git format-patch --stdout HEAD..origin/$GITHUB_REF_NAME CHANGELOG.md | git apply
28+
msg="Merge change log updates from $GITHUB_REF_NAME to main"
29+
git commit -a -m "$msg"
30+
git push origin HEAD:merge-change-log-updates-to-main
31+
gh pr create --title "$msg" \
32+
--body "$msg" \
33+
--head merge-change-log-updates-to-main \
34+
--base main

.github/workflows/prepare-release-branch.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,16 @@ jobs:
1919
echo "VERSION=$version" >> $GITHUB_ENV
2020
echo "RELEASE_BRANCH_NAME=$release_branch_name" >> $GITHUB_ENV
2121
22-
- name: Bump version
22+
- name: Drop snapshot from version
2323
run: |
24-
sed -ri "s/$VERSION-SNAPSHOT/$VERSION/" version.gradle.kts
25-
sed -ri "s/$VERSION-alpha-SNAPSHOT/$VERSION-alpha/" version.gradle.kts
24+
sed -ri "s/val snapshot = true/val snapshot = false/" version.gradle.kts
2625
2726
- name: Set git user
2827
run: |
2928
git config user.name opentelemetry-java-bot
3029
git config user.email [email protected]
3130
32-
- name: Create pull request against release branch
31+
- name: Create pull request against the release branch
3332
env:
3433
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3534
run: |
@@ -58,7 +57,6 @@ jobs:
5857
fi
5958
next_version="$major.$((minor + 1)).0"
6059
sed -ri "s/$version-SNAPSHOT/$next_version-SNAPSHOT/" version.gradle.kts
61-
sed -ri "s/$version-apha-SNAPSHOT/$next_version-apha-SNAPSHOT/" version.gradle.kts
6260
6361
- name: Set git user
6462
run: |

.github/workflows/release.yml

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,17 @@ jobs:
105105
env:
106106
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107107
run: |
108-
if [[ $version == *.0 ]]; then
109-
cat > release-notes.txt << EOF
110-
This release targets the OpenTelemetry SDK $VERSION.
108+
# conditional blocks not indented because of the heredoc
109+
if [[ $VERSION == *.0 ]]; then
110+
cat > release-notes.txt << EOF
111+
This release targets the OpenTelemetry SDK $VERSION.
111112
112-
EOF
113+
EOF
113114
else
114-
cat > release-notes.txt << EOF
115-
This is a patch release on the previous $PRIOR_VERSION release, fixing the issue(s) below.
115+
cat > release-notes.txt << EOF
116+
This is a patch release on the previous $PRIOR_VERSION release, fixing the issue(s) below.
116117
117-
EOF
118+
EOF
118119
fi
119120
120121
sed -n "/^## Version $VERSION/,/^## Version /p" CHANGELOG.md \
@@ -126,15 +127,16 @@ jobs:
126127
| perl -0pe 's/\n +/ /g' \
127128
>> release-notes.txt
128129
129-
if [[ $version == *.0 ]]; then
130-
cat >> release-notes.txt << EOF
130+
# conditional block not indented because of the heredoc
131+
if [[ $VERSION == *.0 ]]; then
132+
cat >> release-notes.txt << EOF
131133
132-
### 🙇 Thank you
133-
This release was possible thanks to the following contributors who shared their brilliant ideas and awesome pull requests:
134+
### 🙇 Thank you
135+
This release was possible thanks to the following contributors who shared their brilliant ideas and awesome pull requests:
134136
135-
EOF
137+
EOF
136138
137-
.github/scripts/generate-release-contributors.sh v$PRIOR_VERSION v$VERSION >> release-notes.txt
139+
.github/scripts/generate-release-contributors.sh v$PRIOR_VERSION $GITHUB_REF_NAME >> release-notes.txt
138140
fi
139141
140142
- name: Create GitHub release
@@ -149,31 +151,24 @@ jobs:
149151
v$VERSION \
150152
opentelemetry-jmx-metrics.jar
151153
152-
- uses: actions/checkout@v3
153-
with:
154-
ref: main
155-
# history is needed in order to generate the patch
156-
fetch-depth: 0
154+
- name: Update the change log with the release date
155+
run: |
156+
date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
157+
sed -ri "s/## Version $VERSION .*/## Version $VERSION ($date)/" CHANGELOG.md
157158
158159
- name: Set git user
159160
run: |
160161
git config user.name opentelemetry-java-bot
161162
git config user.email [email protected]
162163
163-
# this step should be last since it will fail if there have been conflicting
164-
# change log updates introduced on the main branch
165-
- name: Create pull request to merge any change log updates to main
164+
- name: Create pull request against the release branch
166165
env:
167166
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168167
run: |
169-
git format-patch --stdout main..$GITHUB_REF_NAME CHANGELOG.md > patch
170-
if [ -s patch ]; then
171-
git apply patch
172-
msg="Merge change log updates from $GITHUB_REF_NAME to main"
173-
git commit -a -m "$msg"
174-
git push origin HEAD:merge-change-log-updates-to-main
175-
gh pr create --title "$msg" \
176-
--body "$msg" \
177-
--head merge-change-log-updates-to-main \
178-
--base main
179-
fi
168+
msg="Add $VERSION release date to the change log"
169+
git commit -a -m "$msg"
170+
git push origin HEAD:add-$VERSION-release-date
171+
gh pr create --title "[$GITHUB_REF_NAME] $msg" \
172+
--body "$msg" \
173+
--head add-$VERSION-release-date \
174+
--base $GITHUB_REF_NAME

.github/workflows/reusable-markdown-link-check.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ jobs:
1414

1515
- name: Run markdown-link-check
1616
run: |
17-
# --quiet displays errors only, making them easier to find in the log
1817
find . -type f \
1918
-name '*.md' \
2019
-not -path './CHANGELOG.md' \
21-
| xargs markdown-link-check --quiet --config .github/scripts/markdown-link-check-config.json
20+
| xargs .github/scripts/markdown-link-check-with-retry.sh

CHANGELOG.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Changelog
22

3-
## Unreleased
3+
## Version 1.13.0 (unreleased)
44

5-
## Version 1.12.0 - 2022-03-14
5+
## Version 1.12.0 (2022-03-14)
66

77
All components updated to target OpenTelemetry SDK 1.12.0.
88

9-
## Version 1.11.0 - 2022-03-03
9+
## Version 1.11.0 (2022-03-03)
1010

1111
All components updated to target OpenTelemetry SDK 1.11.0.
1212

@@ -38,7 +38,7 @@ All components updated to target OpenTelemetry SDK 1.11.0.
3838
* Update file total metric
3939
([#234](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/234))
4040

41-
## Version 1.10.0 - 2022-01-18
41+
## Version 1.10.0 (2022-01-18)
4242

4343
All components updated to target OpenTelemetry SDK 1.10.0.
4444

@@ -75,7 +75,7 @@ All components updated to target OpenTelemetry SDK 1.10.0.
7575
* Rename contrib-samplers to samplers
7676
([#185](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/185))
7777

78-
## Version 1.9.0 - 2021-12-03
78+
## Version 1.9.0 (2021-12-03)
7979

8080
All components updated to target OpenTelemetry SDK 1.9.1.
8181

@@ -104,7 +104,7 @@ All components updated to target OpenTelemetry SDK 1.9.1.
104104

105105
Skipped to stay in sync with other OpenTelemetry Java repositories.
106106

107-
## Version 1.7.0 - 2021-10-29
107+
## Version 1.7.0 (2021-10-29)
108108

109109
All components updated to target OpenTelemetry SDK 1.7.0.
110110

@@ -140,15 +140,15 @@ Allows programmatic attach of Javaagent.
140140
* Use the [OpenTelemetry SDK Autoconfigure extension](https://github.com/open-telemetry/opentelemetry-java/tree/main/sdk-extensions/autoconfigure) to support more configuration setting. All the settings of the OTLP exporter are supported.
141141
([#112](https://github.com/open-telemetry/opentelemetry-java-contrib/pull/112))
142142

143-
## Version 1.6.0 - 2021-09-22
143+
## Version 1.6.0 (2021-09-22)
144144

145145
All components updated to target OpenTelemetry SDK 1.6.0.
146146

147147
### Maven extension - New 🌟
148148

149149
This extension can be registered in a Maven build to trace different build steps, for example project build and Maven plugin executions.
150150

151-
## Version 1.5.0 - 2021-09-21
151+
## Version 1.5.0 (2021-09-21)
152152

153153
All components updated to target OpenTelemetry SDK 1.5.0.
154154

@@ -159,7 +159,7 @@ All components updated to target OpenTelemetry SDK 1.5.0.
159159
* `*Sum` have been replaced with `*Counter`
160160
* `*Observer` have been replaced with `*Callback` and do not return any object anymore
161161

162-
## Version 1.4.0 - 2021-08-13
162+
## Version 1.4.0 (2021-08-13)
163163

164164
All components updated to target OpenTelemetry SDK 1.4.0.
165165

@@ -171,7 +171,7 @@ This library contains OTel extensions for use with [AWS X-Ray](https://docs.aws.
171171

172172
* Because of numerous backwards incompatible changes in the OpenTelemetry Metrics data model, you will want to make sure you are running the latest version of the OpenTelemetry collector. Older versions will likely not process metrics correctly.
173173

174-
## Version 1.0.0-alpha - 2021-06-02
174+
## Version 1.0.0-alpha (2021-06-02)
175175

176176
### JMX metrics - New 🌟
177177

RELEASING.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ as the last step, which publishes a snapshot build to
1414

1515
* Close the release milestone if there is one.
1616
* Merge a pull request to `main` updating the `CHANGELOG.md`.
17+
* The heading for the release should include the release version but not the release date, e.g.
18+
`## Version 1.9.0 (unreleased)`.
1719
* Run the [Prepare release branch workflow](.github/workflows/prepare-release-branch.yml).
1820
* Review and merge the two pull requests that it creates
1921
(one is targeted to the release branch and one is targeted to the `main` branch).
@@ -24,26 +26,40 @@ All patch releases should include only bug-fixes, and must avoid adding/modifyin
2426

2527
In general, patch releases are only made for regressions, memory leaks and deadlocks.
2628

27-
* Backport pull request(s) to the release branch
29+
* Backport pull request(s) to the release branch.
2830
* Run the [Backport workflow](.github/workflows/backport.yml).
2931
* Press the "Run workflow" button, then select the release branch from the dropdown list,
3032
e.g. `release/v1.9.x`, then enter the pull request number that you want to backport,
3133
then click the "Run workflow" button below that.
32-
* Review and merge the backport pull request that it generates
33-
* Merge a pull request to the release branch updating the `CHANGELOG.md`
34+
* Review and merge the backport pull request that it generates.
35+
* Merge a pull request to the release branch updating the `CHANGELOG.md`.
36+
* The heading for the release should include the release version but not the release date, e.g.
37+
`## Version 1.9.0 (unreleased)`.
3438
* Run the [Prepare patch release workflow](.github/workflows/prepare-patch-release.yml).
3539
* Press the "Run workflow" button, then select the release branch from the dropdown list,
3640
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
37-
* Review and merge the pull request that it creates
41+
* Review and merge the pull request that it creates.
3842

3943
## Making the release
4044

4145
Run the [Release workflow](.github/workflows/release.yml).
4246

4347
* Press the "Run workflow" button, then select the release branch from the dropdown list,
4448
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
45-
* This workflow will publish the artifacts to maven central and will publish a GitHub release with
46-
release notes based on the change log and with the javaagent jar attached.
47-
* Lastly, if there were any change log updates in the release branch that need to be merged back to
48-
the main branch, the workflow will create a pull request if the updates can be cleanly applied,
49-
or it will fail this last step if the updates cannot be cleanly applied.
49+
* This workflow will publish the artifacts to maven central and will publish a GitHub release
50+
with release notes based on the change log and with the jmx metrics jar attached.
51+
* Review and merge the pull request that the release workflow creates against the release branch
52+
which adds the release date to the change log.
53+
54+
## After the release
55+
56+
Run the [Merge change log to main workflow](.github/workflows/merge-change-log-to-main.yml).
57+
58+
* Press the "Run workflow" button, then select the release branch from the dropdown list,
59+
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
60+
* This will create a pull request that merges the change log updates from the release branch
61+
back to main.
62+
* Review and merge the pull request that it creates.
63+
* This workflow will fail if there have been conflicting change log updates introduced in main,
64+
in which case you will need to merge the change log updates manually and send your own pull
65+
request against main.

0 commit comments

Comments
 (0)