|
| 1 | +name: "Release Phar" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "**" |
| 7 | + |
| 8 | +env: |
| 9 | + COMPOSER_VERSION: "2.0.13" |
| 10 | + PHP_EXTENSIONS: "mbstring, ds" |
| 11 | + PHP_INI_VALUES: "memory_limit=-1, phar.readonly=0" |
| 12 | + |
| 13 | +jobs: |
| 14 | + release: |
| 15 | + name: "Release" |
| 16 | + |
| 17 | + runs-on: "ubuntu-latest" |
| 18 | + |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + php-version: |
| 22 | + - "7.4" |
| 23 | + |
| 24 | + env: |
| 25 | + COMPOSER_UNUSED_PHAR: "build/composer-unused.phar" |
| 26 | + COMPOSER_UNUSED_PHAR_SIGNATURE: "build/composer-unused.phar.asc" |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: "Checkout" |
| 30 | + |
| 31 | + |
| 32 | + - name: "Install PHP with extensions" |
| 33 | + uses: "shivammathur/[email protected]" |
| 34 | + with: |
| 35 | + coverage: "none" |
| 36 | + tools: "composer" |
| 37 | + extensions: "${{ env.PHP_EXTENSIONS }}" |
| 38 | + ini-values: "${{ env.PHP_INI_VALUES }}" |
| 39 | + php-version: "${{ matrix.php-version }}" |
| 40 | + |
| 41 | + - name: "Require composer/composer" |
| 42 | + run: "composer require composer/composer:${{ env.COMPOSER_VERSION }} --no-interaction --no-progress" |
| 43 | + |
| 44 | + - name: "Remove dev dependencies" |
| 45 | + run: "composer install --no-progress --no-dev --prefer-dist --optimize-autoloader" |
| 46 | + |
| 47 | + - name: "Validate configuration for humbug/box" |
| 48 | + run: ".phive/box.phar validate box.json" |
| 49 | + |
| 50 | + - name: "Compile composer-unused.phar with humbug/box" |
| 51 | + run: ".phive/box.phar compile --config=box.json" |
| 52 | + |
| 53 | + - name: "Show info about composer-unused.phar with humbug/box" |
| 54 | + run: ".phive/box.phar info ${{ env.COMPOSER_UNUSED_PHAR }}" |
| 55 | + |
| 56 | + - name: "Validate composer-unused.phar against code" |
| 57 | + run: "php ${{ env.COMPOSER_UNUSED_PHAR }} --excludeDir=data" |
| 58 | + |
| 59 | + - name: "Import GPG key" |
| 60 | + id: "import_gpg" |
| 61 | + uses: "crazy-max/ghaction-import-gpg@v3" |
| 62 | + with: |
| 63 | + gpg-private-key: "${{ secrets.GPG_PRIVATE_KEY }}" |
| 64 | + passphrase: "${{ secrets.GPG_PRIVATE_KEY }}" |
| 65 | + |
| 66 | + - name: "Determine tag" |
| 67 | + id: "determine-tag" |
| 68 | + run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\"" |
| 69 | + |
| 70 | + - name: "Create release" |
| 71 | + id: "create-release" |
| 72 | + |
| 73 | + env: |
| 74 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 75 | + with: |
| 76 | + draft: false |
| 77 | + prerelease: false |
| 78 | + release_name: "${{ steps.determine-tag.outputs.tag }}" |
| 79 | + tag_name: "${{ steps.determine-tag.outputs.tag }}" |
| 80 | + |
| 81 | + - name: "Upload composer-unused.phar" |
| 82 | + if: "always()" |
| 83 | + |
| 84 | + env: |
| 85 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 86 | + with: |
| 87 | + asset_content_type: "text/plain" |
| 88 | + asset_name: "composer-unused.phar" |
| 89 | + asset_path: "${{ env.COMPOSER_UNUSED_PHAR }}" |
| 90 | + upload_url: "${{ steps.create-release.outputs.upload_url }}" |
| 91 | + |
| 92 | + - name: "Upload composer-unused.phar.asc" |
| 93 | + if: "always()" |
| 94 | + |
| 95 | + env: |
| 96 | + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
| 97 | + with: |
| 98 | + asset_content_type: "text/plain" |
| 99 | + asset_name: "composer-unused.phar.asc" |
| 100 | + asset_path: "${{ env.COMPOSER_NORMALIZE_PHAR_SIGNATURE }}" |
| 101 | + upload_url: "${{ steps.create-release.outputs.upload_url }}" |
0 commit comments