-
-
Notifications
You must be signed in to change notification settings - Fork 5
73 lines (61 loc) · 2.71 KB
/
draft-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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.1
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 }}**