Skip to content

Merge pull request #104 from jasonw4331/dependabot/composer/phpstan/p… #1

Merge pull request #104 from jasonw4331/dependabot/composer/phpstan/p…

Merge pull request #104 from jasonw4331/dependabot/composer/phpstan/p… #1

Workflow file for this run

name: Draft release
on:
push:
tags: "*"
jobs:
draft:
name: Create GitHub Draft Release
if: "startsWith(github.event.head_commit.message, 'Release ')"
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
ini-values: phar.readonly=0
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress --no-dev --prefer-dist --optimize-autoloader --ignore-platform-reqs
- name: Download Pharynx phar builder
run: wget https://github.com/SOF3/pharynx/releases/latest/download/pharynx.phar -O pharynx.phar
- id: get-manifest
run: |
echo "NAME=$(grep '^name:' plugin.yml | cut -d' ' -f2- | xargs)" >> $GITHUB_OUTPUT
echo "PRERELEASE=$(grep '^version:' plugin.yml | cut -d' ' -f2- | xargs | grep -E 'alpha|beta|pre' && echo 'true')" >> $GITHUB_OUTPUT
echo "API=$(grep '^api:' plugin.yml | cut -d' ' -f2- | xargs)" >> $GITHUB_OUTPUT
sed -i '/src-namespace-prefix/d' plugin.yml
sed -i "s/version: .*/version: ${{ github.ref_name }}/g" plugin.yml
- name: Build plugin archive
run: php pharynx.phar -i . -f LICENSE -c -p=${{ github.workspace }}/${{ steps.get-manifest.outputs.NAME }}.phar
- name: Upload release artifacts
uses: actions/upload-artifact@v4
with:
name: release_artifacts
path: |
${{ github.workspace }}/${{ steps.get-manifest.outputs.NAME }}.phar
- name: Create draft release
uses: ncipollo/release-action@v1
with:
artifacts: ${{ github.workspace }}/${{ steps.get-manifest.outputs.NAME }}.phar
commit: ${{ github.sha }}
draft: true
name: ${{ steps.get-manifest.outputs.NAME }} v${{ github.ref_name }}
prerelease: ${{ steps.get-manifest.outputs.PRERELEASE }}
tag: ${{ github.ref_name }}
#token: ${{ secrets.GITHUB_TOKEN }}
body: |
**For PocketMine API ${{ steps.get-manifest.outputs.API }}**