From 987bafff24ecc4c9ac418cab1145b96dd6e9cbd9 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sat, 2 Mar 2024 08:19:19 +0100 Subject: [PATCH 1/2] Do not use implicitly nullable parameters and prepare release --- ChangeLog.md | 7 +++++++ src/Snapshot.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index e71b787..03f2547 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -2,6 +2,12 @@ All notable changes in `sebastian/global-state` are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles. +## [6.0.2] - 2024-03-02 + +### Changed + +* Do not use implicitly nullable parameters + ## [6.0.1] - 2023-07-19 ### Changed @@ -86,6 +92,7 @@ All notable changes in `sebastian/global-state` are documented in this file usin * This component is no longer supported on PHP 7.0 and PHP 7.1 +[6.0.2]: https://github.com/sebastianbergmann/global-state/compare/6.0.1...6.0.2 [6.0.1]: https://github.com/sebastianbergmann/global-state/compare/6.0.0...6.0.1 [6.0.0]: https://github.com/sebastianbergmann/global-state/compare/5.0.5...6.0.0 [5.0.5]: https://github.com/sebastianbergmann/global-state/compare/5.0.4...5.0.5 diff --git a/src/Snapshot.php b/src/Snapshot.php index 84573a2..310c856 100644 --- a/src/Snapshot.php +++ b/src/Snapshot.php @@ -51,7 +51,7 @@ class Snapshot private array $classes = []; private array $traits = []; - public function __construct(ExcludeList $excludeList = null, bool $includeGlobalVariables = true, bool $includeStaticProperties = true, bool $includeConstants = true, bool $includeFunctions = true, bool $includeClasses = true, bool $includeInterfaces = true, bool $includeTraits = true, bool $includeIniSettings = true, bool $includeIncludedFiles = true) + public function __construct(?ExcludeList $excludeList = null, bool $includeGlobalVariables = true, bool $includeStaticProperties = true, bool $includeConstants = true, bool $includeFunctions = true, bool $includeClasses = true, bool $includeInterfaces = true, bool $includeTraits = true, bool $includeIniSettings = true, bool $includeIncludedFiles = true) { $this->excludeList = $excludeList ?: new ExcludeList; From 05eeca0fa9056456a8df539344ff93e0625a6212 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Sun, 10 Mar 2024 13:24:53 +0100 Subject: [PATCH 2/2] Create release when tag is pushed --- .github/workflows/release.yaml | 39 +++++++++++++++++++++ build/scripts/extract-release-notes.php | 46 +++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100755 build/scripts/extract-release-notes.php diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..2557ae9 --- /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 }} diff --git a/build/scripts/extract-release-notes.php b/build/scripts/extract-release-notes.php new file mode 100755 index 0000000..5531892 --- /dev/null +++ b/build/scripts/extract-release-notes.php @@ -0,0 +1,46 @@ +#!/usr/bin/env php +' . PHP_EOL; + + exit(1); +} + +$version = $argv[1]; + +$file = __DIR__ . '/../../ChangeLog.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;