فهرست منبع

Move and improve change log script (#5845)

Trask Stalnaker 2 سال پیش
والد
کامیت
87a51414f7
4فایلهای تغییر یافته به همراه25 افزوده شده و 6 حذف شده
  1. 22 0
      .github/scripts/draft-change-log-entries.sh
  2. 1 1
      .github/workflows/release.yml
  3. 2 0
      RELEASING.md
  4. 0 5
      buildscripts/draft-change-log-entries.sh

+ 22 - 0
.github/scripts/draft-change-log-entries.sh

@@ -0,0 +1,22 @@
+#!/bin/bash -e
+
+version=$(grep -Eo "[0-9]+.[0-9]+.0" version.gradle.kts | head -1)
+
+if [[ $version =~ ([0-9]+).([0-9]+).0 ]]; then
+  major="${BASH_REMATCH[1]}"
+  minor="${BASH_REMATCH[2]}"
+else
+  echo "unexpected version: $version"
+  exit 1
+fi
+
+if [[ $minor == 0 ]]; then
+  prior_major=$((major - 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
+
+git log --reverse --pretty=format:"- %s" "v$prior_version"..HEAD \
+  | sed -r 's,\(#([0-9]+)\),\n  ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'

+ 1 - 1
.github/workflows/release.yml

@@ -91,7 +91,7 @@ jobs:
               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

+ 2 - 0
RELEASING.md

@@ -16,6 +16,8 @@ as the last step, which publishes a snapshot build to
 * 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)`.
+  * Use `.github/scripts/draft-change-log-entries.sh` as a starting point for writing the change
+    log.
 * Run the [Prepare release branch workflow](.github/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).

+ 0 - 5
buildscripts/draft-change-log-entries.sh

@@ -1,5 +0,0 @@
-#!/bin/bash -e
-
-git log --reverse --pretty=format:"- %s" "$1"..HEAD \
-  | sed -r 's,\(#([0-9]+)\),\n  ([#\1](https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/\1)),'
-echo