-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automated PHAR build using GitHub Actions (#3)
* Create build_phar.yml * Fix ConsoleScript URL * FIxing releases tag * Attempt #2 * Change tag and SHA to short version * Delete unused files * oops * Oops again * Oops again * Add RFC 3339 date * Hopefully this is the last * This time * ...
- Loading branch information
Showing
1 changed file
with
55 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,55 @@ | ||
name: Build PHAR | ||
|
||
on: [ push, pull_request ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout GitHub repo | ||
uses: actions/checkout@v2 | ||
|
||
# https://stackoverflow.com/a/59819441 | ||
- name: Set custom variables | ||
id: vars | ||
run: | | ||
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | ||
echo "::set-output name=date::$(date --rfc-3339=seconds)" | ||
- name: Make '.build' directory | ||
run: mkdir .build | ||
|
||
- name: Download DevTools/ConsoleScript.php | ||
run: wget -O .build/build.php https://raw.githubusercontent.com/pmmp/DevTools/master/src/ConsoleScript.php | ||
|
||
- name: Delete unused files | ||
run: | | ||
shopt -s extglob | ||
rm -rfv !("src"|"plugin.yml"|".build"|".git") | ||
- name: Display structure of current working directory | ||
run: ls -laR | ||
|
||
- name: Build source to PHAR | ||
run: php -dphar.readonly=0 .build/build.php --make ./ --out .build/Height_${{ steps.vars.outputs.sha_short }}.phar | ||
|
||
- name: Release PHAR artifact to GitHub Releases | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: build_${{ steps.vars.outputs.sha_short }} | ||
name: Height - Build ${{ steps.vars.outputs.sha_short }} | ||
body: | | ||
Build Date: `${{ steps.vars.outputs.date }}` | ||
Build SHA: ${{ steps.vars.outputs.sha_short }} | ||
Last Commit Message: `${{ github.event.commits[0].message }}` | ||
## IMPORTANT | ||
This is an unstable build of the Height plugin. Only use this build for testing or development purposes. | ||
### Why we use GitHub Releases? | ||
We use GitHub Releases instead of GitHub Actions artifacts to retain every build as long as possible. | ||
prerelease: true | ||
fail_on_unmatched_files: true | ||
files: | | ||
.build/Height_${{ steps.vars.outputs.sha_short }}.phar |