Sync'ing workflow changes/fixes (#4388)

* Sync

* Fix prepare release workflow

* Better links

* Fix links

* Fix links

* Fix

* format

* Sync release branch name

* Add comment

* more
This commit is contained in:
Trask Stalnaker 2022-04-18 19:49:41 -07:00 committed by GitHub
parent e6280139b8
commit a547e2a1ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 69 additions and 52 deletions

View File

@ -3,5 +3,10 @@
"aliveStatusCodes": [
200,
403
],
"ignorePatterns": [
{
"pattern": "^https://github.com/open-telemetry/TODO/"
}
]
}

View File

@ -71,13 +71,13 @@ jobs:
markdown-link-check:
# release branches are excluded to avoid unnecessary maintenance if external links break
if: ${{ !startsWith(github.ref_name, 'v') }}
if: ${{ !startsWith(github.ref_name, 'release/') }}
uses: ./.github/workflows/reusable-markdown-link-check.yml
misspell-check:
# release branches are excluded to avoid unnecessary maintenance if new misspellings are added
# to the misspell dictionary
if: ${{ !startsWith(github.ref_name, 'v') }}
if: ${{ !startsWith(github.ref_name, 'release/') }}
uses: ./.github/workflows/reusable-misspell-check.yml
publish-snapshots:

View File

@ -31,7 +31,7 @@ jobs:
- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v1
issue:
open-issue-on-failure:
needs: analyze
if: failure()
uses: ./.github/workflows/reusable-create-issue-for-failure.yml

View File

@ -4,7 +4,7 @@ on:
jobs:
create-pull-request:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:

View File

@ -10,7 +10,7 @@ jobs:
- name: Set environment variables
run: |
prior_version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1)
prior_version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts)
if [[ $prior_version =~ ([0-9]+.[0-9]+).([0-9]+) ]]; then
major_minor="${BASH_REMATCH[1]}"
patch="${BASH_REMATCH[2]}"
@ -19,11 +19,10 @@ jobs:
exit 1
fi
echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV
- name: Bump version
- name: Update version
run: |
sed -ri "s/$PRIOR_VERSION/$VERSION/" version.gradle.kts
sed -ri "s/[0-9]+\.[0-9]+\.[0-9]+/$VERSION/" version.gradle.kts
- name: Set git user
run: |

View File

@ -11,7 +11,7 @@ jobs:
- name: Create release branch
id: create-release-branch
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.0-SNAPSHOT" version.gradle.kts | sed 's/-SNAPSHOT//')
version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
release_branch_name=$(echo $version | sed -E 's,([0-9]+)\.([0-9]+)\.0,release/v\1.\2.x,')
git push origin HEAD:$release_branch_name
@ -19,7 +19,7 @@ jobs:
echo "VERSION=$version" >> $GITHUB_ENV
echo "RELEASE_BRANCH_NAME=$release_branch_name" >> $GITHUB_ENV
- name: Drop snapshot from version
- name: Update version
run: |
sed -ri "s/val snapshot = true/val snapshot = false/" version.gradle.kts
@ -45,9 +45,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Bump snapshot version
- name: Update version
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.0-SNAPSHOT" version.gradle.kts | sed 's/-SNAPSHOT//')
version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts)
if [[ $version =~ ([0-9]+).([0-9]+).0 ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
@ -56,7 +56,7 @@ jobs:
exit 1
fi
next_version="$major.$((minor + 1)).0"
sed -ri "s/$version-SNAPSHOT/$next_version-SNAPSHOT/" version.gradle.kts
sed -ri "s/[0-9]+\.[0-9]+\.[0-9]+/$next_version/" version.gradle.kts
- name: Set git user
run: |
@ -67,10 +67,10 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
msg="Bump version"
msg="Update version"
git commit -a -m "$msg"
git push origin HEAD:bump-snapshot-version
git push origin HEAD:update-version-on-main
gh pr create --title "$msg" \
--body "$msg" \
--head bump-snapshot-version \
--head update-version-on-main \
--base main

View File

@ -26,7 +26,7 @@ jobs:
- name: Set versions
id: set-versions
run: |
version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1)
version=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts)
if [[ $version =~ ([0-9]+).([0-9]+).([0-9]+) ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
@ -38,13 +38,13 @@ jobs:
if [[ $patch == 0 ]]; then
if [[ $minor == 0 ]]; then
prior_major=$((major - 1))
prior_minor=$(grep -Po "^## Version $prior_major.\K([0-9]+)" CHANGELOG.md | head -1)
prior_minor=$(grep -Po "^## Version $prior_major.\K([0-9]+)" CHANGELOG.md | head -1)
prior_version="$prior_major.$prior_minor"
else
prior_version="$major.$((minor - 1)).0"
fi
else
prior_version="$major.$minor.$((patch - 1))"
prior_version="$major.$minor.$((patch - 1))"
fi
echo "VERSION=$version" >> $GITHUB_ENV
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV
@ -98,6 +98,8 @@ jobs:
v$VERSION
- name: Update the change log with the release date
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
date=$(gh release view v$VERSION --json publishedAt --jq .publishedAt | sed 's/T.*//')
sed -ri "s/## Version $VERSION .*/## Version $VERSION ($date)/" CHANGELOG.md

View File

@ -14,8 +14,8 @@ to view a summary of all commits since last release as a reference.
* Close the release milestone if there is one.
* Merge a pull request to `main` updating the `CHANGELOG.md`.
* The heading for the release should include the release version but not the release date, e.g.
`## Version 1.9.0 (unreleased)`.
* Run the [Prepare release branch workflow](.github/workflows/prepare-release-branch.yml).
`## Version 1.9.0 (unreleased)`.
* Run the [Prepare release branch workflow](https://github.com/open-telemetry/opentelemetry-java/actions/workflows/prepare-release-branch.yml).
* Review and merge the two pull requests that it creates
(one is targeted to the release branch and one is targeted to the `main` branch).
@ -26,22 +26,22 @@ All patch releases should include only bug-fixes, and must avoid adding/modifyin
In general, patch releases are only made for regressions, memory leaks and deadlocks.
* Backport pull request(s) to the release branch.
* Run the [Backport workflow](.github/workflows/backport.yml).
* Run the [Backport workflow](https://github.com/open-telemetry/opentelemetry-java/actions/workflows/backport.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, then enter the pull request number that you want to backport,
then click the "Run workflow" button below that.
* Review and merge the backport pull request that it generates.
* Merge a pull request to the release branch updating the `CHANGELOG.md`.
* The heading for the release should include the release version but not the release date, e.g.
`## Version 1.9.0 (unreleased)`.
* Run the [Prepare patch release workflow](.github/workflows/prepare-patch-release.yml).
`## Version 1.9.0 (unreleased)`.
* Run the [Prepare patch release workflow](https://github.com/open-telemetry/opentelemetry-java/actions/workflows/prepare-patch-release.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
* Review and merge the pull request that it creates.
## Making the release
Run the [Release workflow](.github/workflows/release.yml).
Run the [Release workflow](https://github.com/open-telemetry/opentelemetry-java/actions/workflows/release.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
@ -52,7 +52,7 @@ Run the [Release workflow](.github/workflows/release.yml).
## After the release
Run the [Merge change log to main workflow](.github/workflows/merge-change-log-to-main.yml).
Run the [Merge change log to main workflow](https://github.com/open-telemetry/opentelemetry-java/actions/workflows/merge-change-log-to-main.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.

View File

@ -127,6 +127,7 @@ jobs:
open-issue-on-failure:
# open an issue on failure because it can be easy to miss CI failure notifications
runs-on: ubuntu-latest
needs: analyze
if: failure()
steps:
@ -381,30 +382,30 @@ Here's some sample `RELEASING.md` documentation that goes with the automation be
* Close the release milestone if there is one.
* Merge a pull request to `main` updating the `CHANGELOG.md`.
* The heading for the release should include the release version but not the release date, e.g.
`## Version 1.9.0 (unreleased)`.
* Run the [Prepare release branch workflow](.github/workflows/prepare-release-branch.yml).
`## Version 1.9.0 (unreleased)`.
* Run the [Prepare release branch workflow](https://github.com/open-telemetry/TODO/actions/workflows/prepare-release-branch.yml).
* Review and merge the two pull requests that it creates
(one is targeted to the release branch and one is targeted to `main`).
## Preparing a new patch release
* Backport pull request(s) to the release branch.
* Run the [Backport workflow](.github/workflows/backport.yml).
* Run the [Backport workflow](https://github.com/open-telemetry/TODO/actions/workflows/backport.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, then enter the pull request number that you want to backport,
then click the "Run workflow" button below that.
* Review and merge the backport pull request that it generates.
* Merge a pull request to the release branch updating the `CHANGELOG.md`.
* The heading for the release should include the release version but not the release date, e.g.
`## Version 1.9.0 (unreleased)`.
* Run the [Prepare patch release workflow](.github/workflows/prepare-patch-release.yml).
`## Version 1.9.0 (unreleased)`.
* Run the [Prepare patch release workflow](https://github.com/open-telemetry/TODO/actions/workflows/prepare-patch-release.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
* Review and merge the pull request that it creates.
## Making the release
Run the [Release workflow](.github/workflows/release.yml).
Run the [Release workflow](https://github.com/open-telemetry/TODO/actions/workflows/release.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
@ -416,7 +417,7 @@ Run the [Release workflow](.github/workflows/release.yml).
## After the release
Run the [Merge change log to main workflow](.github/workflows/merge-change-log-to-main.yml).
Run the [Merge change log to main workflow](https://github.com/open-telemetry/TODO/actions/workflows/merge-change-log-to-main.yml).
* Press the "Run workflow" button, then select the release branch from the dropdown list,
e.g. `release/v1.9.x`, and click the "Run workflow" button below that.
@ -438,6 +439,7 @@ This is what we use in the OpenTelemetry Java repositories:
```yaml
- name: Set git user
run: |
# TODO replace opentelemetry-java-bot info with your bot account
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
```
@ -446,14 +448,14 @@ This is what we use in the OpenTelemetry Java repositories:
Uses release branch naming convention `release/v*`.
The specifics below depend a lot on your specific version bumping needs.
The specifics below depend a lot on your specific version updating needs.
For OpenTelemetry Java repositories, the version in `main` always ends with `-SNAPSHOT`,
so preparing the release branch involves
* removing `-SNAPSHOT` from the version on the release branch
(e.g. updating the version from `1.2.0-SNAPSHOT` to `1.2.0`)
* bumping the version to the next `-SNAPSHOT` on `main`
* updating the version to the next `-SNAPSHOT` on `main`
(e.g. updating the version from `1.2.0-SNAPSHOT` to `1.3.0-SNAPSHOT`)
```yaml
@ -470,7 +472,8 @@ jobs:
- name: Create release branch
id: create-release-branch
run: |
version=$(...) <-- get the version that is planned to be released
# TODO get the version that is planned to be released
version=$(...)
release_branch_name=$(echo $version | sed -E 's,([0-9]+)\.([0-9]+)\.0,release/v\1.\2.x,')
git push origin HEAD:$release_branch_name
@ -478,9 +481,9 @@ jobs:
echo "VERSION=$version" >> $GITHUB_ENV
echo "RELEASE_BRANCH_NAME=$release_branch_name" >> $GITHUB_ENV
- name: Bump version
- name: Update version
run: |
.github/scripts/update-versions.sh $VERSION-SNAPSHOT $VERSION
# TODO update version to $VERSION
- name: Set up git name
run: |
@ -505,7 +508,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Bump version on main
- name: Update version
run: |
version=$(...) <-- get the minor version that is planning to be released
if [[ $version =~ ([0-9]+).([0-9]+).0 ]]; then
@ -516,7 +519,7 @@ jobs:
exit 1
fi
next_version="$major.$((minor + 1)).0"
.github/scripts/update-versions.sh $version-SNAPSHOT $next_version-SNAPSHOT
# TODO update version to $next_version
- name: Set up git name
run: |
@ -528,21 +531,21 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
msg="Bump version"
msg="Update version"
git commit -a -m "$msg"
git push origin HEAD:bump-snapshot-version
git push origin HEAD:update-version-on-main
gh pr create --title "$msg" \
--body "$msg" \
--head bump-snapshot-version \
--head update-version-on-main \
--base main
```
### Prepare patch
The specifics depend a lot on the build tool and your version bumping needs.
The specifics depend a lot on the build tool and your version updating needs.
For OpenTelemetry Java repositories, we have a workflow which generates a pull request
against the release branch to bump the version (e.g. from `1.2.0` to `1.2.1`).
against the release branch to update the version (e.g. from `1.2.0` to `1.2.1`).
```yaml
name: Prepare patch release
@ -566,11 +569,10 @@ jobs:
exit 1
fi
echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV
- name: Bump version
- name: Update version
run: |
.github/scripts/update-versions.sh $PRIOR_VERSION $VERSION
# TODO update version to $VERSION
- name: Set up git name
run: |
@ -657,13 +659,13 @@ jobs:
if [[ $patch == 0 ]]; then
if [[ $minor == 0 ]]; then
prior_major=$((major - 1))
prior_minor=$(grep -Po "^## Version $prior_major.\K([0-9]+)" CHANGELOG.md | head -1)
prior_minor=$(grep -Po "^## Version $prior_major.\K([0-9]+)" CHANGELOG.md | head -1)
prior_version="$prior_major.$prior_minor"
else
prior_version="$major.$((minor - 1)).0"
fi
else
prior_version="$major.$minor.$((patch - 1))"
prior_version="$major.$minor.$((patch - 1))"
fi
echo "VERSION=$version" >> $GITHUB_ENV
echo "PRIOR_VERSION=$prior_version" >> $GITHUB_ENV
@ -716,12 +718,15 @@ hitting the "Publish release" button).
```yaml
- name: Update the change log with the release date
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: |
# TODO replace opentelemetry-java-bot info with your bot account
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
@ -743,6 +748,10 @@ hitting the "Publish release" button).
For example to send a PR to notify/update another repository that a new release is available
as part of the release workflow.
Note that the Personal Access Token used will need `workflow` (Update GitHub Action workflows)
permission since it will be updating the workflows of the origin repository when it pushes the
branch and workflows have been updated upstream.
```yaml
- uses: actions/checkout@v3
with:
@ -756,12 +765,13 @@ as part of the release workflow.
git fetch upstream
git checkout -b update-opentelemetry-javaagent-to-$VERSION upstream/main
- name: Bump version
- name: Update version
run: |
echo $VERSION > autoinstrumentation/java/version.txt
- name: Set git user
run: |
# TODO replace opentelemetry-java-bot info with your bot account
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com
@ -802,7 +812,7 @@ on:
jobs:
create-pull-request:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
@ -814,6 +824,7 @@ jobs:
- name: Set git user
run: |
# TODO replace opentelemetry-java-bot info with your bot account
git config user.name opentelemetry-java-bot
git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com