forked from Shock95/AuctionHouse
-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (85 loc) · 3.3 KB
/
phar-build.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: CI
on: [ push ]
jobs:
build:
name: Build plugin
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare directories
run: |
mkdir target
mkdir plugin
- name: Move files to plugin folder
run: |
mv resources src plugin.yml -t plugin
- name: Setup PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
ini-values: phar.readonly=0
- name: Read plugin name
id: plugin-name
uses: KJ002/read-yaml@main
with:
file: './plugin/plugin.yml'
key-path: '["name"]'
- name: Download ConsoleScript
run: wget https://gist.githubusercontent.com/brokiem/3a407df6372ed1410cfb38cf99762a3f/raw/3f7e65b169a13bff5f2ec91669f9b474cf25a6cc/ConsoleScript.php
- name: Build plugin
run: php ConsoleScript.php --make / --relative plugin --out target/${{ steps.plugin-name.outputs.data }}.phar
- name: Check libraries file
id: libraries-file
uses: andstor/file-existence-action@v1
with:
files: ".libraries.yml"
- name: Read libraries
if: steps.libraries-file.outputs.files_exists == 'true'
id: libraries
uses: KJ002/read-yaml@main
with:
file: './.libraries.yml'
key-path: '["libs"]'
- name: Download virions
if: steps.libraries-file.outputs.files_exists == 'true'
run: php -r 'foreach(${{ steps.libraries.outputs.data }} as $lib){ exec("wget $lib"); echo "Downloaded virion " . basename($lib); }'
- name: Inject virions
if: steps.libraries-file.outputs.files_exists == 'true'
run: php -r 'foreach(${{ steps.libraries.outputs.data }} as $lib){ exec("php " . basename($lib) . " target/${{ steps.plugin-name.outputs.data }}.phar"); echo "\nInjected virion " . basename($lib); }'
- name: Compress phar
run: php -r '(new \Phar("./target/${{ steps.plugin-name.outputs.data }}.phar"))->compressFiles(\Phar::GZ); echo "\nFinished compression";'
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.plugin-name.outputs.data }}.phar
path: target/${{ steps.plugin-name.outputs.data }}.phar
prepare-release:
name: Make release
needs: [ build ]
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '[release]')
steps:
- uses: actions/checkout@v2
- name: Download artifact
uses: actions/download-artifact@v2
- name: Read plugin name
id: plugin-name
uses: KJ002/read-yaml@main
with:
file: './plugin.yml'
key-path: '["name"]'
- name: Read plugin version
id: plugin-version
uses: KJ002/read-yaml@main
with:
file: './plugin.yml'
key-path: '["version"]'
- name: Create and publish release
uses: marvinpinto/[email protected]
with:
automatic_release_tag: "${{ steps.plugin-version.outputs.data }}"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
title: "${{ steps.plugin-name.outputs.data }} v${{ steps.plugin-version.outputs.data }}"
files: |
${{ steps.plugin-name.outputs.data }}.phar
prerelease: false