From 4ed8d5184827fda148cd3e491c037b98de3f9f7a Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Sun, 20 Feb 2022 20:52:32 -0800 Subject: [PATCH] Add prepare patch release workflow (#5411) --- .github/workflows/prepare-patch-release.yml | 51 +++++++++++++++++++++ RELEASING.md | 9 ++-- 2 files changed, 56 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/prepare-patch-release.yml diff --git a/.github/workflows/prepare-patch-release.yml b/.github/workflows/prepare-patch-release.yml new file mode 100644 index 000000000000..c778b1c39f02 --- /dev/null +++ b/.github/workflows/prepare-patch-release.yml @@ -0,0 +1,51 @@ +name: Prepare Patch Release +on: + workflow_dispatch: + +jobs: + prepare-patch-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + with: + ref: ${{ github.ref_name }} + + - name: Set versions + id: set-versions + run: | + v=$(grep -Eo "[0-9]+.[0-9]+.[0-9]+" version.gradle.kts | head -1) + if [[ $v =~ ([0-9]+.[0-9]+).([0-9]+) ]]; then + major_minor="${BASH_REMATCH[1]}" + patch="${BASH_REMATCH[2]}" + else + echo "unexpected version: $v" + exit 1 + fi + echo "::set-output name=release-version::$major_minor.$((patch + 1))" + echo "::set-output name=prior-version::$v" + + - name: Bump version + run: | + .github/scripts/update-versions.sh "${{ steps.set-versions.outputs.prior-version }}" "${{ steps.set-versions.outputs.prior-version }}-alpha" "${{ steps.set-versions.outputs.release-version }}" "${{ steps.set-versions.outputs.release-version }}-alpha" + + - name: Bump download link version + run: | + sed -Ei "s,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${{ steps.set-versions.outputs.prior-version }}/,https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v${{ steps.set-versions.outputs.release-version }}/," README.md + + - name: Setup git name + run: | + git config user.name opentelemetry-java-bot + git config user.email 97938252+opentelemetry-java-bot@users.noreply.github.com + + - name: Create pull request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + msg="Prepare patch release ${{ steps.set-versions.outputs.release-version }}" + git add -u + git commit -m "$msg" + git push origin HEAD:prepare-patch-release-${{ steps.set-versions.outputs.release-version }} + gh pr create --title "$msg" \ + --body "$msg" \ + --head prepare-patch-release-${{ steps.set-versions.outputs.release-version }} \ + --base ${{ github.ref_name }} diff --git a/RELEASING.md b/RELEASING.md index 01bbfe72cbf7..75cab1ec898b 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -57,10 +57,11 @@ Before making the release: * Merge PR(s) containing the desired patches to the release branch * Merge a PR to the release branch updating the `CHANGELOG.md` -* Merge a PR to the release branch updating the version in these files: - * version.gradle.kts - * examples/distro/build.gradle - * examples/extension/build.gradle +* Run the [Prepare Patch Release workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/prepare-patch-release.yml). + * Press the "Run workflow" button, then select the release branch from the dropdown list, + e.g. `v1.9.x`, and click the "Run workflow" button below that. +* Review and merge the PR that it creates +* Delete the branch from the PR since it is created in the main repo Open the [Release workflow](https://github.com/open-telemetry/opentelemetry-java-instrumentation/actions/workflows/release.yml).