From aac77264cd69850ff55eaba6b9f2fccb4d9069f2 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sat, 9 Mar 2024 11:46:57 +0100 Subject: [PATCH 1/3] Initial work on script that extracts release notes from ChangeLog file #5550 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastian Bergmann Co-authored-by: Arne Blankerts Co-authored-by: Andreas Möller Co-authored-by: Sebastian Heuer Co-authored-by: Fabian Blechschmidt Co-authored-by: Frank Sons --- build/scripts/extract-release-notes.php | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 build/scripts/extract-release-notes.php diff --git a/build/scripts/extract-release-notes.php b/build/scripts/extract-release-notes.php new file mode 100755 index 00000000000..390143980d1 --- /dev/null +++ b/build/scripts/extract-release-notes.php @@ -0,0 +1,47 @@ +#!/usr/bin/env php +' . PHP_EOL; + + exit(1); +} + +$version = $argv[1]; +$versionSeries = explode('.', $version)[0] . '.' . explode('.', $version)[1]; + +$file = __DIR__ . '/../../ChangeLog-' . $versionSeries . '.md'; + +if (!is_file($file) || !is_readable($file)) { + print $file . ' cannot be read' . PHP_EOL; + + exit(1); +} + +$buffer = ''; +$append = false; + +foreach (file($file) as $line) { + if (str_starts_with($line, '## [' . $version . ']')) { + $append = true; + + continue; + } + + if ($append && (str_starts_with($line, '## ') || str_starts_with($line, '['))) { + break; + } + + if ($append) { + $buffer .= $line; + } +} + +$buffer = trim($buffer); + +if ($buffer === '') { + print 'Unable to extract release notes' . PHP_EOL; + + exit(1); +} + +print $buffer . PHP_EOL; From 34b51b25858c9567ac86a0b8f22bd78cf71e7169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sat, 9 Mar 2024 11:54:37 +0100 Subject: [PATCH 2/3] Enhancement: Create release when tag is pushed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastian Bergmann Co-authored-by: Arne Blankerts Co-authored-by: Andreas Möller Co-authored-by: Sebastian Heuer Co-authored-by: Fabian Blechschmidt Co-authored-by: Frank Sons --- .github/workflows/release.yaml | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000000..c2cf235c009 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,39 @@ +# https://docs.github.com/en/actions + +on: + push: + tags: + - "**" + +name: Release + +jobs: + release: + name: Release + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: 8.3 + coverage: none + extensions: none + tools: none + + - name: Determine tag + run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Parse changelog + run: build/scripts/extract-release-notes.php ${{ env.RELEASE_TAG }} > release-notes.md + + - name: Create release + uses: ncipollo/release-action@v1 + with: + bodyFile: release-notes.md + tag: ${{ env.RELEASE_TAG }} + token: ${{ secrets.GITHUB_TOKEN }} From 944c4c615f345458f3bb5fe6ec336cc91aa0375d Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sat, 9 Mar 2024 12:50:29 +0100 Subject: [PATCH 3/3] Add link to documentation --- build/scripts/extract-release-notes.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build/scripts/extract-release-notes.php b/build/scripts/extract-release-notes.php index 390143980d1..9383ff3abba 100755 --- a/build/scripts/extract-release-notes.php +++ b/build/scripts/extract-release-notes.php @@ -44,4 +44,11 @@ exit(1); } -print $buffer . PHP_EOL; +printf( + '%s%s---%s[How to install or update PHPUnit](https://docs.phpunit.de/en/%s/installation.html)%s', + $buffer, + PHP_EOL, + PHP_EOL, + $versionSeries, + PHP_EOL, +);