Skip to content

Merge branch 'release/4.0.0' #21

Merge branch 'release/4.0.0'

Merge branch 'release/4.0.0' #21

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
phar:
name: Compile PHAR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Check if tag is valid
- name: Check tag
if: ${{ github.event_name != 'workflow_dispatch' }}
run: |
if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
exit 1
fi
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2, phive
# Compile PHAR
- name: Install box
run: phive install --trust-gpg-keys 2DF45277AEF09A2F humbug/box
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: "--no-dev"
- name: Compile PHAR
run: ./tools/box compile
# Upload compiled PHAR as artifact
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: phar
path: |
.build/frontend-asset-handler.phar
release:
name: Create release
if: ${{ github.event_name != 'workflow_dispatch' }}
runs-on: ubuntu-latest
needs: phar
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Check if tag is valid
- name: Check tag
run: |
if ! [[ ${{ github.ref }} =~ ^refs/tags/[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$ ]]; then
exit 1
fi
# Download PHAR
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: phar
path: .build
- name: Make PHAR executable
run: chmod +x .build/frontend-asset-handler.phar
# Sign PHAR file
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.PHAR_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PHAR_GPG_PASSPHRASE }}
- name: Sign PHAR file
run: gpg --armor --output .build/frontend-asset-handler.phar.asc --yes --detach-sig .build/frontend-asset-handler.phar
# Create release
- name: Create release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
artifacts: .build/frontend-asset-handler.phar,.build/frontend-asset-handler.phar.asc