Skip to content

Create .poggit.yml

Create .poggit.yml #58

Workflow file for this run

name: "Stable release"
on:
push:
branches: [ "main" ]
jobs:
release:
name: "Create stable release"
if: "!contains(github.event.head_commit.message, 'ci ignore')"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Setup PHP 8.0
uses: shivammathur/[email protected]
with:
php-version: 8.0
tools: composer
extensions: yaml pthreads sockets mysqli zlib
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Composer
run: |
composer update --no-interaction --ignore-platform-reqs
composer install --no-suggest --no-interaction --ignore-platform-reqs
- name: "Get data"
id: metadata
run: |
echo "NEW_VERSION=$(php -r 'echo version_compare(yaml_parse_file(getcwd() . DIRECTORY_SEPARATOR . "plugin.yml")["version"]), file_get_contents(__DIR__ + "/version-pocketmine-mp.txt"), ">=");')" >> $GITHUB_OUTPUT
echo "VERSION=$(php -r 'echo explode("+", explode("-", yaml_parse_file(getcwd() . DIRECTORY_SEPARATOR . "plugin.yml")["version"])[0])[0];')" >> $GITHUB_OUTPUT
echo "FULL_VERSION=$(php -r 'echo yaml_parse_file(getcwd() . DIRECTORY_SEPARATOR . "plugin.yml")["version"];')" >> $GITHUB_OUTPUT
echo "NAME=$(php -r 'echo yaml_parse_file(getcwd() . DIRECTORY_SEPARATOR . "plugin.yml")["name"];')" >> $GITHUB_OUTPUT
- name: "Build phar"
run: "php -dphar.readonly=0 build.php"
- name: "Rename PHAR"
run: |
cp ${{ steps.metadata.outputs.NAME }}.phar Presence-Man-PocketMine-MP-v${{ steps.metadata.outputs.VERSION }}.phar
cp ${{ steps.metadata.outputs.NAME }}.phar Presence-Man-PocketMine-MP.phar
- name: "Create Release"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "v${{ steps.metadata.outputs.VERSION }}"
prerelease: false
title: "Stable release v${{ steps.metadata.outputs.VERSION }}"
files: "Presence-Man-PocketMine-MP.phar"
- name: "Create latest_version.txt"
run: "echo \"${{ steps.metadata.outputs.VERSION }}\" > latest_version.txt"
- name: "Update version.txt"
uses: "test-room-7/action-update-file@v1"
with:
file-path: latest_version.txt
commit-msg: "Updated latest version to ${{ steps.metadata.outputs.VERSION }} - ci ignore"
github-token: ${{ secrets.GITHUB_TOKEN }}