Skip to content
---
on: # yamllint disable-line rule:truthy
release:
types:
- published
name: πŸ“¦ Build PHAR release
jobs:
build-release:
runs-on: ubuntu-latest
timeout-minutes: 4
strategy:
matrix:
php-version:
- '8.2'
dependencies:
- locked
env:
DLOAD_PHAR: ".build/phar/dload.phar"
DLOAD_PHAR_SIGNATURE: ".build/phar/dload.phar.asc"
GPG_KEYS: ".build/phar/keys.asc"
GPG_KEYS_ENCRYPTED: ".github/phar/keys.asc.gpg"
steps:
- name: πŸ“¦ Check out the codebase
uses: actions/checkout@v4.1.5
- name: πŸ› οΈ Setup PHP
uses: shivammathur/setup-php@2.30.4
with:
php-version: ${{ matrix.php-version }}
extensions: none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, sockets
ini-values: error_reporting=E_ALL
coverage: none
tools: phive
- name: πŸ› οΈ Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: πŸ€– Validate composer.json and composer.lock
run: composer validate --ansi --strict
- name: πŸ” Get composer cache directory
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
- name: ♻️ Restore cached dependencies installed with composer
uses: actions/cache@v4.0.2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
- name: πŸ“₯ Install "${{ matrix.dependencies }}" dependencies with composer
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
with:
dependencies: ${{ matrix.dependencies }}
- name: πŸ“₯ Install dependencies with phive
uses: wayofdev/gh-actions/actions/phive/install@v3.1.0
with:
phive-home: '.phive'
trust-gpg-keys: '0xC00543248C87FB13,0x033E5F8D801A2F8D,0x2DF45277AEF09A2F'
- name: πŸ” Validate configuration for box-project/box
run: .phive/box validate box.json.dist --ansi
- name: πŸ€– Compile dload.phar with box-project/box
run: .phive/box compile --ansi
- name: πŸ’₯ Show info about dload.phar with box-project/box
run: .phive/box info ${{ env.DLOAD_PHAR }} --ansi
- name: πŸ€” Run dload.phar help command
run: ${{ env.DLOAD_PHAR }} --help
- name: πŸ” Show gpg version
run: gpg --version
- name: πŸ”‘ Decrypt keys.asc.gpg with gpg
run: gpg --batch --output ${{ env.GPG_KEYS }} --passphrase "${{ secrets.GPG_DECRYPT_PASSPHRASE }}" --yes --decrypt ${{ env.GPG_KEYS_ENCRYPTED }}
- name: πŸ“₯ Import keys from keys.asc with gpg
run: gpg --batch --import ${{ env.GPG_KEYS }}
- name: πŸ” Sign dload.phar with gpg
run: gpg --armor --local-user "${{ secrets.GPG_LOCAL_USER }}" --output ${{ env.DLOAD_PHAR_SIGNATURE }} --passphrase "${{ secrets.GPG_KEY_PASSPHRASE }}" --pinentry-mode loopback --yes --detach-sig ${{ env.DLOAD_PHAR }}
- name: ❎ Remove decrypted keys.asc
run: rm ${{ env.GPG_KEYS }}
- name: πŸ“€ Upload release assets
uses: softprops/action-gh-release@v2.0.5
if: startsWith(github.ref, 'refs/tags/')
with:
token: "${{ secrets.DLOAD_RELEASE_TOKEN }}"
files: |
${{ env.DLOAD_PHAR }}
${{ env.DLOAD_PHAR_SIGNATURE }}