diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fecff90..61e11ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,42 +1,63 @@ - on: push - name: Release workflow - jobs: - build-phar: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - - - name: Setup PHP - uses: shivammathur/setup-php@master - with: - php-version: 7.4 - ini-values: memory_limit=2G, display_errors=On, error_reporting=-1, phar.readonly=0 - tools: pecl, 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-progress --prefer-dist --optimize-autoloader - - - name: Install phive tools - run: phive install --trust-gpg-keys 2A8299CE842DD38C - - - name: Create build dir - run: make phar - - - name: Upload PHAR file - uses: actions/upload-artifact@v2.2.0 - with: - name: prophecy-phpunit.phar - path: build/prophecy-phpunit.phar - +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