63 lines
2.2 KiB
YAML
63 lines
2.2 KiB
YAML
name: Prepare patch release
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
prepare-patch-release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
|
|
- run: |
|
|
if [[ ! $GITHUB_REF_NAME =~ ^release/v[0-9]+\.[0-9]+\.x$ ]]; then
|
|
echo this workflow should only be run against release branches
|
|
exit 1
|
|
fi
|
|
|
|
if ! grep --quiet "^## Unreleased$" CHANGELOG.md; then
|
|
echo the change log is missing an \"Unreleased\" section
|
|
exit 1
|
|
fi
|
|
|
|
- name: Set environment variables
|
|
run: |
|
|
version=$(.github/scripts/get-version.sh)
|
|
if [[ $version =~ ^([0-9]+\.[0-9]+)\.([0-9]+)$ ]]; then
|
|
major_minor="${BASH_REMATCH[1]}"
|
|
patch="${BASH_REMATCH[2]}"
|
|
else
|
|
echo "unexpected version: $version"
|
|
exit 1
|
|
fi
|
|
echo "VERSION=$major_minor.$((patch + 1))" >> $GITHUB_ENV
|
|
|
|
- name: Update version
|
|
run: .github/scripts/update-version.sh $VERSION
|
|
|
|
- name: Update download link version
|
|
run: |
|
|
sed -Ei "s,https://github\.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v[0-9]+\.[0-9]+\.[0-9]+/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$VERSION/," README.md
|
|
|
|
- name: Update the change log with the approximate release date
|
|
run: |
|
|
date=$(date "+%Y-%m-%d")
|
|
sed -Ei "s/^## Unreleased$/## Version $VERSION ($date)/" CHANGELOG.md
|
|
|
|
- name: Use CLA approved github bot
|
|
run: .github/scripts/use-cla-approved-github-bot.sh
|
|
|
|
- name: Create pull request
|
|
env:
|
|
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows
|
|
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
|
run: |
|
|
message="Prepare release $VERSION"
|
|
branch="opentelemetrybot/prepare-release-${VERSION}"
|
|
|
|
git checkout -b $branch
|
|
git commit -a -m "$message"
|
|
git push --set-upstream origin $branch
|
|
gh pr create --title "[$GITHUB_REF_NAME] $message" \
|
|
--body "$message." \
|
|
--base $GITHUB_REF_NAME
|