mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-30 17:09:47 +00:00
120 lines
4.8 KiB
YAML
120 lines
4.8 KiB
YAML
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 }}
|
|
|
|
jobs:
|
|
draft:
|
|
name: Create GitHub draft release
|
|
|
|
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:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@2.31.1
|
|
with:
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
- name: Restore Composer package cache
|
|
uses: actions/cache@v4
|
|
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 build/dump-version-info.php base_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
|
|
|
|
- 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
|
|
|
|
- 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: Generate core permission doc for doc.pmmp.io
|
|
run: php tools/generate-permission-doc.php rst
|
|
|
|
- name: Upload release artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: release_artifacts
|
|
path: |
|
|
${{ github.workspace }}/PocketMine-MP.phar
|
|
${{ github.workspace }}/start.*
|
|
${{ github.workspace }}/build_info.json
|
|
${{ github.workspace }}/core-permissions.rst
|
|
|
|
- name: Create draft release
|
|
uses: ncipollo/release-action@v1.14.0
|
|
id: create-draft
|
|
with:
|
|
artifacts: ${{ github.workspace }}/PocketMine-MP.phar,${{ github.workspace }}/start.*,${{ github.workspace }}/build_info.json,${{ github.workspace }}/core-permissions.rst
|
|
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 }}
|
|
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 }}).
|