forked from brokiem/Trashcan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
libs: | ||
- https://poggit.pmmp.io/r/189672/InvMenu_dev-1.phar | ||
- https://poggit.pmmp.io/r/168608/UpdateChecker_dev-14.phar |