From fe7c282052af55f4ed23d9e6629e1e7c0a501121 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 12:03:09 +0000 Subject: [PATCH 1/6] Bump pocketmine/locale-data in the production-patch-updates group (#6568) --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 1cf141588..54f65014f 100644 --- a/composer.lock +++ b/composer.lock @@ -471,16 +471,16 @@ }, { "name": "pocketmine/locale-data", - "version": "2.22.0", + "version": "2.22.1", "source": { "type": "git", "url": "https://github.com/pmmp/Language.git", - "reference": "aed64e9ca92ffbb20788b3b3bb75b60e4f0eae2d" + "reference": "fa4e377c437391cfcfdedd08eea3a848eabd1b49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pmmp/Language/zipball/aed64e9ca92ffbb20788b3b3bb75b60e4f0eae2d", - "reference": "aed64e9ca92ffbb20788b3b3bb75b60e4f0eae2d", + "url": "https://api.github.com/repos/pmmp/Language/zipball/fa4e377c437391cfcfdedd08eea3a848eabd1b49", + "reference": "fa4e377c437391cfcfdedd08eea3a848eabd1b49", "shasum": "" }, "type": "library", @@ -488,9 +488,9 @@ "description": "Language resources used by PocketMine-MP", "support": { "issues": "https://github.com/pmmp/Language/issues", - "source": "https://github.com/pmmp/Language/tree/2.22.0" + "source": "https://github.com/pmmp/Language/tree/2.22.1" }, - "time": "2024-11-16T13:28:01+00:00" + "time": "2024-12-06T14:44:17+00:00" }, { "name": "pocketmine/log", From a8eaa43bc8beaf273ce806ff314d1eecf1545fef Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 9 Dec 2024 16:36:26 +0000 Subject: [PATCH 2/6] Recombine release workflows having two different workflows able to trigger releases is a pain for build number continuity. perhaps longer term we should source the build number a different way, but these workflows needed restructuring anyway. --- .github/workflows/draft-release-from-pr.yml | 65 -------------- .github/workflows/draft-release-from-tag.yml | 13 --- .github/workflows/draft-release.yml | 94 +++++++++++++++----- 3 files changed, 70 insertions(+), 102 deletions(-) delete mode 100644 .github/workflows/draft-release-from-pr.yml delete mode 100644 .github/workflows/draft-release-from-tag.yml diff --git a/.github/workflows/draft-release-from-pr.yml b/.github/workflows/draft-release-from-pr.yml deleted file mode 100644 index 8a347853b..000000000 --- a/.github/workflows/draft-release-from-pr.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Draft release from PR - -on: - #presume that pull_request_target is safe at this point, since the PR was approved and merged - #we need write access to prepare the release & create comments - pull_request_target: - types: - - closed - branches: - - stable - - minor-next - - major-next - - "legacy/*" - paths: - - "src/VersionInfo.php" - -jobs: - check: - name: Check release - uses: ./.github/workflows/draft-release-pr-check.yml - - draft: - name: Create GitHub draft release - needs: [check] - if: needs.check.outputs.valid == 'true' - - uses: ./.github/workflows/draft-release.yml - - post-draft-url-comment: - name: Post draft release URL as comment - needs: [draft] - - runs-on: ubuntu-20.04 - - steps: - - name: Post draft release URL on PR - uses: thollander/actions-comment-pull-request@v3 - with: - message: "[Draft release ${{ needs.draft.outputs.version }}](${{ needs.draft.outputs.draft-url }}) has been created for commit ${{ github.sha }}. Please review and publish it." - - trigger-post-release-workflow: - name: Trigger post-release RestrictedActions workflow - # Not sure if needs is actually needed here - needs: [check] - if: needs.check.outputs.valid == 'true' - - runs-on: ubuntu-20.04 - - steps: - - name: Generate access token - id: generate-token - uses: actions/create-github-app-token@v1 - with: - app-id: ${{ vars.RESTRICTED_ACTIONS_DISPATCH_ID }} - private-key: ${{ secrets.RESTRICTED_ACTIONS_DISPATCH_KEY }} - owner: ${{ github.repository_owner }} - repositories: RestrictedActions - - - name: Dispatch post-release restricted action - uses: peter-evans/repository-dispatch@v3 - with: - token: ${{ steps.generate-token.outputs.token }} - repository: ${{ github.repository_owner }}/RestrictedActions - event-type: pocketmine_mp_post_release - client-payload: '{"branch": "${{ github.ref }}"}' diff --git a/.github/workflows/draft-release-from-tag.yml b/.github/workflows/draft-release-from-tag.yml deleted file mode 100644 index f7a5df544..000000000 --- a/.github/workflows/draft-release-from-tag.yml +++ /dev/null @@ -1,13 +0,0 @@ -#Allows creating a release by pushing a tag -#This might be useful for retroactive releases -name: Draft release from git tag - -on: - push: - tags: "*" - -jobs: - draft: - name: Create GitHub draft release - if: "startsWith(github.event.head_commit.message, 'Release ')" - uses: ./.github/workflows/draft-release.yml diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index cd1841e4f..3374ff68f 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -1,28 +1,61 @@ name: Draft release on: - workflow_call: - outputs: - draft-url: - description: 'The URL of the draft release' - value: ${{ jobs.draft.outputs.draft-url }} - version: - description: 'PocketMine-MP version' - value: ${{ jobs.draft.outputs.version }} + #presume that pull_request_target is safe at this point, since the PR was approved and merged + #we need write access to prepare the release & create comments + pull_request_target: + types: + - closed + branches: + - stable + - minor-next + - major-next + - "legacy/*" + paths: + - "src/VersionInfo.php" + push: + tags: + - "*" + +env: + PHP_VERSION: "8.2" jobs: - draft: - name: Create GitHub draft release + check: + name: Check release + uses: ./.github/workflows/draft-release-pr-check.yml + + trigger-post-release-workflow: + name: Trigger post-release RestrictedActions workflow + needs: [check] + if: needs.check.outputs.valid == 'true' && github.ref_type != 'tag' #can't do post-commit for a tag runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - php-version: [8.2] - outputs: - draft-url: ${{ steps.create-draft.outputs.html_url }} - version: ${{ steps.get-pm-version.outputs.PM_VERSION }} + steps: + - name: Generate access token + id: generate-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.RESTRICTED_ACTIONS_DISPATCH_ID }} + private-key: ${{ secrets.RESTRICTED_ACTIONS_DISPATCH_KEY }} + owner: ${{ github.repository_owner }} + repositories: RestrictedActions + + - name: Dispatch post-release restricted action + uses: peter-evans/repository-dispatch@v3 + with: + token: ${{ steps.generate-token.outputs.token }} + repository: ${{ github.repository_owner }}/RestrictedActions + event-type: pocketmine_mp_post_release + client-payload: '{"branch": "${{ github.ref }}"}' + + draft: + name: Create GitHub draft release + needs: [check] + if: needs.check.outputs.valid == 'true' || github.ref_type == 'tag' #ignore validity check for tags + + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v4 @@ -32,7 +65,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@2.31.1 with: - php-version: ${{ matrix.php-version }} + php-version: ${{ env.PHP_VERSION }} - name: Restore Composer package cache uses: actions/cache@v4 @@ -50,7 +83,7 @@ jobs: - name: Calculate build number id: build-number run: | - BUILD_NUMBER=$((2000+$GITHUB_RUN_NUMBER)) #to stay above jenkins + BUILD_NUMBER=$((2300+$GITHUB_RUN_NUMBER)) #to stay above jenkins echo "Build number: $BUILD_NUMBER" echo BUILD_NUMBER=$BUILD_NUMBER >> $GITHUB_OUTPUT @@ -63,23 +96,31 @@ jobs: - name: Get PocketMine-MP release version id: get-pm-version run: | - echo PM_VERSION=$(php build/dump-version-info.php base_version) >> $GITHUB_OUTPUT + PM_VERSION=$(php build/dump-version-info.php base_version) + echo PM_VERSION=$PM_VERSION >> $GITHUB_OUTPUT echo PM_MAJOR=$(php build/dump-version-info.php major_version) >> $GITHUB_OUTPUT echo MCPE_VERSION=$(php build/dump-version-info.php mcpe_version) >> $GITHUB_OUTPUT echo CHANGELOG_FILE_NAME=$(php build/dump-version-info.php changelog_file_name) >> $GITHUB_OUTPUT echo CHANGELOG_MD_HEADER=$(php build/dump-version-info.php changelog_md_header) >> $GITHUB_OUTPUT echo PRERELEASE=$(php build/dump-version-info.php prerelease) >> $GITHUB_OUTPUT + if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then + tag="$(echo "${{ github.ref }}" | cut -d/ -f3-)" + else + tag="$PM_VERSION" + fi + echo TAG_NAME=$tag >> $GITHUB_OUTPUT + - name: Generate PHP binary download URL id: php-binary-url run: | - echo PHP_BINARY_URL="${{ github.server_url }}/${{ github.repository_owner }}/PHP-Binaries/releases/tag/pm${{ steps.get-pm-version.outputs.PM_MAJOR }}-php-${{ matrix.php-version }}-latest" >> $GITHUB_OUTPUT + echo PHP_BINARY_URL="${{ github.server_url }}/${{ github.repository_owner }}/PHP-Binaries/releases/tag/pm${{ steps.get-pm-version.outputs.PM_MAJOR }}-php-${{ env.PHP_VERSION }}-latest" >> $GITHUB_OUTPUT - name: Generate build info run: | php build/generate-build-info-json.php \ ${{ github.sha }} \ - ${{ steps.get-pm-version.outputs.PM_VERSION }} \ + ${{ steps.get-pm-version.outputs.TAG_NAME }} \ ${{ github.repository }} \ ${{ steps.build-number.outputs.BUILD_NUMBER }} \ ${{ github.run_id }} \ @@ -108,12 +149,17 @@ jobs: draft: true prerelease: ${{ steps.get-pm-version.outputs.PRERELEASE }} name: PocketMine-MP ${{ steps.get-pm-version.outputs.PM_VERSION }} - tag: ${{ steps.get-pm-version.outputs.PM_VERSION }} + tag: ${{ steps.get-pm-version.outputs.TAG_NAME }} token: ${{ secrets.GITHUB_TOKEN }} - skipIfReleaseExists: true #for release PRs, tags will be created on release publish and trigger the tag release workflow - don't create a second draft body: | **For Minecraft: Bedrock Edition ${{ steps.get-pm-version.outputs.MCPE_VERSION }}** Please see the [changelogs](${{ github.server_url }}/${{ github.repository }}/blob/${{ steps.get-pm-version.outputs.PM_VERSION }}/changelogs/${{ steps.get-pm-version.outputs.CHANGELOG_FILE_NAME }}#${{ steps.get-pm-version.outputs.CHANGELOG_MD_HEADER }}) for details. :information_source: Download the recommended PHP binary [here](${{ steps.php-binary-url.outputs.PHP_BINARY_URL }}). + + - name: Post draft release URL on PR + if: github.event_name == 'pull_request_target' + uses: thollander/actions-comment-pull-request@v3 + with: + message: "[Draft release ${{ steps.get-pm-version.outputs.PM_VERSION }}](${{ steps.create-draft.outputs.html_url }}) has been created for commit ${{ github.sha }}. Please review and publish it." From ad6d34f1a61b8392e5541c94e3a35413c68aeb2e Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 9 Dec 2024 16:44:07 +0000 Subject: [PATCH 3/6] Remove legacy make-release script we no longer use this release workflow, all releases should now be done via pull request --- build/make-release.php | 174 --------------------- tests/phpstan/configs/actual-problems.neon | 5 - 2 files changed, 179 deletions(-) delete mode 100644 build/make-release.php diff --git a/build/make-release.php b/build/make-release.php deleted file mode 100644 index 741f9d787..000000000 --- a/build/make-release.php +++ /dev/null @@ -1,174 +0,0 @@ - "Version to insert and tag", - "next" => "Version to put in the file after tagging", - "channel" => "Release channel to post this build into" -]; - -function systemWrapper(string $command, string $errorMessage) : void{ - system($command, $result); - if($result !== 0){ - echo "error: $errorMessage; aborting\n"; - exit(1); - } -} - -function main() : void{ - $filteredOpts = []; - $postCommitOnly = false; - foreach(Utils::stringifyKeys(getopt("", ["current:", "next:", "channel:", "help", "post"])) as $optName => $optValue){ - if($optName === "help"){ - fwrite(STDOUT, "Options:\n"); - - $maxLength = max(array_map(fn(string $str) => strlen($str), array_keys(ACCEPTED_OPTS))); - foreach(ACCEPTED_OPTS as $acceptedName => $description){ - fwrite(STDOUT, str_pad("--$acceptedName", $maxLength + 4, " ", STR_PAD_LEFT) . ": $description\n"); - } - exit(0); - } - if($optName === "post"){ - $postCommitOnly = true; - continue; - } - if(!is_string($optValue)){ - fwrite(STDERR, "--$optName expects exactly 1 value\n"); - exit(1); - } - $filteredOpts[$optName] = $optValue; - } - - $channel = $filteredOpts["channel"] ?? null; - if(isset($filteredOpts["current"])){ - $currentVer = new VersionString($filteredOpts["current"]); - }else{ - $currentVer = new VersionString(VersionInfo::BASE_VERSION); - } - - $nextVer = isset($filteredOpts["next"]) ? new VersionString($filteredOpts["next"]) : null; - - $suffix = $currentVer->getSuffix(); - if($suffix !== ""){ - if($channel === "stable"){ - fwrite(STDERR, "error: cannot release a suffixed build into the stable channel\n"); - exit(1); - } - if(preg_match('/^([A-Za-z]+)(\d+)$/', $suffix, $matches) !== 1){ - echo "error: invalid current version suffix \"$suffix\"; aborting\n"; - exit(1); - } - $nextVer ??= new VersionString(sprintf( - "%u.%u.%u-%s%u", - $currentVer->getMajor(), - $currentVer->getMinor(), - $currentVer->getPatch(), - $matches[1], - ((int) $matches[2]) + 1 - )); - $channel ??= strtolower($matches[1]); - }else{ - $nextVer ??= new VersionString(sprintf( - "%u.%u.%u", - $currentVer->getMajor(), - $currentVer->getMinor(), - $currentVer->getPatch() + 1 - )); - $channel ??= "stable"; - } - - $versionInfoPath = dirname(__DIR__) . '/src/VersionInfo.php'; - - if($postCommitOnly){ - echo "Skipping release commit & tag. Bumping to next version $nextVer directly.\n"; - }else{ - echo "About to tag version $currentVer. Next version will be $nextVer.\n"; - echo "$currentVer will be published on release channel \"$channel\".\n"; - echo "please add appropriate notes to the changelog and press enter..."; - fgets(STDIN); - systemWrapper('git add "' . dirname(__DIR__) . '/changelogs"', "failed to stage changelog changes"); - system('git diff --cached --quiet "' . dirname(__DIR__) . '/changelogs"', $result); - if($result === 0){ - echo "error: no changelog changes detected; aborting\n"; - exit(1); - } - replaceVersion($versionInfoPath, $currentVer->getBaseVersion(), false, $channel); - systemWrapper('git commit -m "Release ' . $currentVer->getBaseVersion() . '" --include "' . $versionInfoPath . '"', "failed to create release commit"); - systemWrapper('git tag ' . $currentVer->getBaseVersion(), "failed to create release tag"); - } - - replaceVersion($versionInfoPath, $nextVer->getBaseVersion(), true, $channel); - systemWrapper('git add "' . $versionInfoPath . '"', "failed to stage changes for post-release commit"); - systemWrapper('git commit -m "' . $nextVer->getBaseVersion() . ' is next" --include "' . $versionInfoPath . '"', "failed to create post-release commit"); -} - -main(); diff --git a/tests/phpstan/configs/actual-problems.neon b/tests/phpstan/configs/actual-problems.neon index f15dc9d53..b071d2a7e 100644 --- a/tests/phpstan/configs/actual-problems.neon +++ b/tests/phpstan/configs/actual-problems.neon @@ -1,10 +1,5 @@ parameters: ignoreErrors: - - - message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#" - count: 2 - path: ../../../build/make-release.php - - message: "#^Parameter \\#1 \\$strings of function pocketmine\\\\build\\\\server_phar\\\\preg_quote_array expects array\\, array\\ given\\.$#" count: 1 From bba525da02e9c0d8878927578ae4a25ec9984934 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 9 Dec 2024 16:44:25 +0000 Subject: [PATCH 4/6] Remove dead PHPStan ignored errors --- tests/phpstan/configs/actual-problems.neon | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/tests/phpstan/configs/actual-problems.neon b/tests/phpstan/configs/actual-problems.neon index b071d2a7e..1bb9329f0 100644 --- a/tests/phpstan/configs/actual-problems.neon +++ b/tests/phpstan/configs/actual-problems.neon @@ -455,26 +455,6 @@ parameters: count: 1 path: ../../../src/command/defaults/TimeCommand.php - - - message: "#^Parameter \\#1 \\$stream of function fclose expects resource, resource\\|false given\\.$#" - count: 2 - path: ../../../src/command/defaults/TimingsCommand.php - - - - message: "#^Parameter \\#1 \\$stream of function fseek expects resource, resource\\|false given\\.$#" - count: 1 - path: ../../../src/command/defaults/TimingsCommand.php - - - - message: "#^Parameter \\#1 \\$stream of function fwrite expects resource, resource\\|false given\\.$#" - count: 1 - path: ../../../src/command/defaults/TimingsCommand.php - - - - message: "#^Parameter \\#1 \\$stream of function stream_get_contents expects resource, resource\\|false given\\.$#" - count: 1 - path: ../../../src/command/defaults/TimingsCommand.php - - message: "#^Parameter \\#1 \\$path of static method pocketmine\\\\utils\\\\Filesystem\\:\\:cleanPath\\(\\) expects string, mixed given\\.$#" count: 1 From 6f197bc1bb90c248a4361669a02f11f3ee4fa86f Mon Sep 17 00:00:00 2001 From: "Dylan T." Date: Mon, 9 Dec 2024 16:51:41 +0000 Subject: [PATCH 5/6] 5.23.2 (#6569) --- changelogs/5.23.md | 13 +++++++++++++ src/VersionInfo.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changelogs/5.23.md b/changelogs/5.23.md index 7f40b40af..6e72e9403 100644 --- a/changelogs/5.23.md +++ b/changelogs/5.23.md @@ -114,3 +114,16 @@ Released 5th December 2024. ## Internals - Improved blockstate consistency check to detect tiles disappearing during refactors. + +# 5.23.2 +Released 9th December 2024. + +## General +- Updated translations for Russian and Korean. + +## Fixes +- Fixed server build number. +- Fixed some crashes being misreported as plugin-involved. + +## Internals +- Removed legacy `build/make-release.php` script. This script is no longer used, as all releases should now follow the PR workflow. diff --git a/src/VersionInfo.php b/src/VersionInfo.php index 1eca900cf..ba46bd63b 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -32,7 +32,7 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; public const BASE_VERSION = "5.23.2"; - public const IS_DEVELOPMENT_BUILD = true; + public const IS_DEVELOPMENT_BUILD = false; public const BUILD_CHANNEL = "stable"; /** From 67b9d6222d17e77c8000a52bdfe61de7e51ebd5c Mon Sep 17 00:00:00 2001 From: "pmmp-admin-bot[bot]" <188621379+pmmp-admin-bot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:52:50 +0000 Subject: [PATCH 6/6] 5.23.3 is next Commit created by: https://github.com/pmmp/RestrictedActions/actions/runs/12240364052 --- src/VersionInfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VersionInfo.php b/src/VersionInfo.php index ba46bd63b..48ce7dc9e 100644 --- a/src/VersionInfo.php +++ b/src/VersionInfo.php @@ -31,8 +31,8 @@ use function str_repeat; final class VersionInfo{ public const NAME = "PocketMine-MP"; - public const BASE_VERSION = "5.23.2"; - public const IS_DEVELOPMENT_BUILD = false; + public const BASE_VERSION = "5.23.3"; + public const IS_DEVELOPMENT_BUILD = true; public const BUILD_CHANNEL = "stable"; /**