diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..61e11ff --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,63 @@ +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 +name: Release workflow +jobs: + build-phar: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.3 + ini-values: memory_limit=2G, display_errors=On, error_reporting=-1, phar.readonly=0 + tools: phive + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ hashFiles('**/composer.lock') }} + restore-keys: composer- + + - name: Install Composer dependencies + run: | + composer install --no-dev --no-progress --prefer-dist --optimize-autoloader + + - name: Remove phpunit + run: composer remove phpunit/phpunit + + - name: Install phive tools + run: phive install --trust-gpg-keys 2A8299CE842DD38C + + - name: Build phar + run: make phar + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/prophecy-phpunit.phar + asset_name: prophecy-phpunit.phar + asset_content_type: application/zip diff --git a/.gitignore b/.gitignore index 9d98656..e39cd52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ vendor +build composer.lock phpunit.xml .*.cache diff --git a/.phive/phars.xml b/.phive/phars.xml new file mode 100644 index 0000000..a5cb741 --- /dev/null +++ b/.phive/phars.xml @@ -0,0 +1,4 @@ + + + + diff --git a/composer.json b/composer.json index 83a8818..bec680e 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,9 @@ "phpspec/prophecy": "^1.18", "phpunit/phpunit":"^9.1 || ^10.1" }, + "require-dev": { + "phar-io/manifest": "^2.0" + }, "autoload": { "psr-4": { "Prophecy\\PhpUnit\\": "src" diff --git a/makefile b/makefile new file mode 100644 index 0000000..c5318a4 --- /dev/null +++ b/makefile @@ -0,0 +1,11 @@ +phar: + mkdir build; + cp -r src build/src; + cp -r vendor build; + rm -r build/vendor/phpspec; + cp manifest.xml build/manifest.xml; + cp LICENSE build/LICENSE + php -dphar.readonly=0 ./tools/phpab --phar -o ./build/prophecy-phpunit.phar --all --hash SHA-1 ./build + +clean: + rm -r build diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 0000000..2c5352d --- /dev/null +++ b/manifest.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + +