|
| 1 | +--- |
| 2 | + |
| 3 | +on: # yamllint disable-line rule:truthy |
| 4 | + release: |
| 5 | + types: |
| 6 | + - published |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +name: 📦 Build PHAR release |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + timeout-minutes: 4 |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + php-version: |
| 18 | + - '8.3' |
| 19 | + dependencies: |
| 20 | + - locked |
| 21 | + env: |
| 22 | + PHONY_PHAR: ".build/phar/phony.phar" |
| 23 | + PHONY_PHAR_SIGNATURE: ".build/phar/phony.phar.asc" |
| 24 | + GPG_KEYS: ".build/phar/keys.asc" |
| 25 | + GPG_KEYS_ENCRYPTED: ".github/phar/keys.asc.gpg" |
| 26 | + steps: |
| 27 | + - name: 📦 Check out the codebase |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: 🛠️ Setup PHP |
| 31 | + uses: shivammathur/setup-php@2.33.0 |
| 32 | + with: |
| 33 | + php-version: ${{ matrix.php-version }} |
| 34 | + extensions: none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, sockets, intl |
| 35 | + ini-values: error_reporting=E_ALL |
| 36 | + coverage: none |
| 37 | + tools: phive |
| 38 | + |
| 39 | + - name: 🛠️ Setup problem matchers |
| 40 | + run: | |
| 41 | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
| 42 | +
|
| 43 | + - name: 🤖 Validate composer.json and composer.lock |
| 44 | + run: composer validate --ansi --strict |
| 45 | + |
| 46 | + - name: 🔍 Get composer cache directory |
| 47 | + uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.3.0 |
| 48 | + |
| 49 | + - name: ♻️ Restore cached dependencies installed with composer |
| 50 | + uses: actions/cache@v4 |
| 51 | + with: |
| 52 | + path: ${{ env.COMPOSER_CACHE_DIR }} |
| 53 | + key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }} |
| 54 | + restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- |
| 55 | + |
| 56 | + - name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer |
| 57 | + uses: wayofdev/gh-actions/actions/composer/install@v3.3.0 |
| 58 | + with: |
| 59 | + dependencies: ${{ matrix.dependencies }} |
| 60 | + |
| 61 | + - name: 📥 Install dependencies with phive |
| 62 | + uses: wayofdev/gh-actions/actions/phive/install@v3.3.0 |
| 63 | + with: |
| 64 | + phive-home: '.phive' |
| 65 | + trust-gpg-keys: '0xC00543248C87FB13,0x033E5F8D801A2F8D,0x2DF45277AEF09A2F' |
| 66 | + |
| 67 | + - name: 🔍 Validate configuration for box-project/box |
| 68 | + run: .phive/box validate box.json.dist --ansi |
| 69 | + |
| 70 | + - name: 🤖 Compile phony.phar with box-project/box |
| 71 | + run: .phive/box compile --ansi |
| 72 | + |
| 73 | + - name: 💥 Show info about phony.phar with box-project/box |
| 74 | + run: .phive/box info ${{ env.PHONY_PHAR }} --ansi |
| 75 | + |
| 76 | + - name: 🤔 Run phony.phar help command |
| 77 | + run: ${{ env.PHONY_PHAR }} --help |
| 78 | + |
| 79 | + - name: 🔍 Show gpg version |
| 80 | + run: gpg --version |
| 81 | + |
| 82 | + - name: 🔑 Decrypt keys.asc.gpg with gpg |
| 83 | + run: gpg --batch --output ${{ env.GPG_KEYS }} --passphrase "${{ secrets.GPG_DECRYPT_PASSPHRASE }}" --yes --decrypt ${{ env.GPG_KEYS_ENCRYPTED }} |
| 84 | + |
| 85 | + - name: 📥 Import keys from keys.asc with gpg |
| 86 | + run: gpg --batch --import ${{ env.GPG_KEYS }} |
| 87 | + |
| 88 | + - name: 🔐 Sign phony.phar with gpg |
| 89 | + run: gpg --armor --local-user "${{ secrets.GPG_LOCAL_USER }}" --output ${{ env.PHONY_PHAR_SIGNATURE }} --passphrase "${{ secrets.GPG_KEY_PASSPHRASE }}" --pinentry-mode loopback --yes --detach-sig ${{ env.PHONY_PHAR }} |
| 90 | + |
| 91 | + - name: ❎ Remove decrypted keys.asc |
| 92 | + run: rm ${{ env.GPG_KEYS }} |
| 93 | + |
| 94 | + - name: 📤 Upload release assets |
| 95 | + uses: softprops/action-gh-release@v2.5.0 |
| 96 | + if: startsWith(github.ref, 'refs/tags/') |
| 97 | + with: |
| 98 | + token: "${{ secrets.GITHUB_TOKEN }}" |
| 99 | + files: | |
| 100 | + ${{ env.PHONY_PHAR }} |
| 101 | + ${{ env.PHONY_PHAR_SIGNATURE }} |
| 102 | +
|
| 103 | +... |
0 commit comments