Draft release #190
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Draft release | |
on: | |
push: | |
tags: "*" | |
jobs: | |
draft: | |
name: Create GitHub draft release | |
if: "startsWith(github.event.head_commit.message, 'Release ')" | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: [8.1] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup PHP | |
uses: shivammathur/setup-php@2.26.0 | |
with: | |
php-version: ${{ matrix.php-version }} | |
- name: Restore Composer package cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/composer/files | |
~/.cache/composer/vcs | |
key: "composer-v2-cache-${{ hashFiles('./composer.lock') }}" | |
restore-keys: | | |
composer-v2-cache- | |
- name: Install Composer dependencies | |
run: composer install --no-dev --prefer-dist --no-interaction --ignore-platform-reqs | |
- name: Calculate build number | |
id: build-number | |
run: | | |
BUILD_NUMBER=$((2000+$GITHUB_RUN_NUMBER)) #to stay above jenkins | |
echo "Build number: $BUILD_NUMBER" | |
echo BUILD_NUMBER=$BUILD_NUMBER >> $GITHUB_OUTPUT | |
- name: Minify BedrockData JSON files | |
run: php vendor/pocketmine/bedrock-data/.minify_json.php | |
- name: Build PocketMine-MP.phar | |
run: php -dphar.readonly=0 build/server-phar.php --git ${{ github.sha }} --build ${{ steps.build-number.outputs.BUILD_NUMBER }} | |
- name: Get PocketMine-MP release version | |
id: get-pm-version | |
run: | | |
echo PM_VERSION=$(php -r 'require "vendor/autoload.php"; echo \pocketmine\VersionInfo::BASE_VERSION;') >> $GITHUB_OUTPUT | |
echo MCPE_VERSION=$(php -r 'require "vendor/autoload.php"; echo \pocketmine\network\mcpe\protocol\ProtocolInfo::MINECRAFT_VERSION_NETWORK;') >> $GITHUB_OUTPUT | |
echo PM_VERSION_SHORT=$(php -r 'require "vendor/autoload.php"; $v = explode(".", \pocketmine\VersionInfo::BASE_VERSION); array_pop($v); echo implode(".", $v);') >> $GITHUB_OUTPUT | |
echo PM_VERSION_MD=$(php -r 'require "vendor/autoload.php"; echo str_replace(".", "", \pocketmine\VersionInfo::BASE_VERSION);') >> $GITHUB_OUTPUT | |
echo CHANGELOG_SUFFIX=$(php -r 'require "vendor/autoload.php"; echo \pocketmine\VersionInfo::BUILD_CHANNEL === "stable" ? "" : "-" . \pocketmine\VersionInfo::BUILD_CHANNEL;') >> $GITHUB_OUTPUT | |
echo PRERELEASE=$(php -r 'require "vendor/autoload.php"; echo \pocketmine\VersionInfo::BUILD_CHANNEL === "stable" ? "false" : "true";') >> $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/php-${{ matrix.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 }} \ | |
${{ github.repository }} \ | |
${{ steps.build-number.outputs.BUILD_NUMBER }} \ | |
${{ github.run_id }} \ | |
${{ steps.php-binary-url.outputs.PHP_BINARY_URL }} \ | |
> build_info.json | |
- name: Upload release artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release_artifacts | |
path: | | |
${{ github.workspace }}/PocketMine-MP.phar | |
${{ github.workspace }}/start.* | |
${{ github.workspace }}/build_info.json | |
- name: Create draft release | |
uses: ncipollo/release-action@v1.13.0 | |
with: | |
artifacts: ${{ github.workspace }}/PocketMine-MP.phar,${{ github.workspace }}/start.*,${{ github.workspace }}/build_info.json | |
commit: ${{ github.sha }} | |
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 }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
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.PM_VERSION_SHORT }}${{ steps.get-pm-version.outputs.CHANGELOG_SUFFIX }}.md#${{ steps.get-pm-version.outputs.PM_VERSION_MD }}) for details. | |
:information_source: Download the recommended PHP binary [here](${{ steps.php-binary-url.outputs.PHP_BINARY_URL }}). |