Skip to content

Commit

Permalink
prepare action for build phar, fix #33
Browse files Browse the repository at this point in the history
  • Loading branch information
Insolita committed Apr 15, 2021
1 parent 88f3111 commit 0927628
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/builder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
set -eu

box validate || exit 1
box compile || exit 1

if [ ! -f "./unused_scanner.phar" ] || [ ! -x "./unused_scanner.phar" ]; then
(>&2 echo "Phar build failed :-(")
exit 1
fi
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: release
# on:
# push:
# tags:
# - '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.1'
extensions: intl, zip, zlib, mbstring
coverage: none
ini-values: memory_limit=1G, phar.readonly=0

- name: Get composer cache directory
id: composer_release_cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer packages
id: composer-release-cache
uses: actions/cache@v2
with:
path: ${{ steps.composer_release_cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install
run: composer install --prefer-dist --no-interaction --no-ansi --no-progress --no-suggest

- name: Install Box
run: composer global require humbug/box

- name: Phar building
run: .github/builder.sh

- name: Getting Tag Name
id: get-version
run: echo ::set-output name=version::${GITHUB_REF#refs/tags/}

- name: Self-Test
run: ./unused_scanner.phar --version

- name: Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.get-version.outputs.version }}
tag: ${{ steps.get-version.outputs.version }}
body: 'Next stable release.'
allowUpdates: true
artifacts: unused_scanner.phar
artifactContentType: application/x-php
8 changes: 8 additions & 0 deletions box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"chmod": "0755" ,
"directories": [ "Lib" , "Exceptions" , "vendor" ] ,
"files": [ "README.md" ] ,
"main": "unused_scanner" ,
"output": "unused_scanner.phar" ,
"stub": true
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"psr-4": {
"insolita\\Scanner\\Lib\\": "Lib" ,
"insolita\\Scanner\\Exceptions\\": "Exceptions",
"tests": "tests"
"tests\\": "tests"
}
} ,
"extra": {
Expand Down

0 comments on commit 0927628

Please sign in to comment.