Merge branch 'update' #85
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- "v[0-9]*" | |
jobs: | |
check-ci-runs: | |
name: Check CI workflow runs | |
runs-on: ubuntu-latest | |
outputs: | |
ci_required: ${{ steps.check-ci-runs.outputs.ci_required }} | |
steps: | |
- name: Check CI runs | |
id: check-ci-runs | |
uses: lkrms/check-ci-runs@v1 | |
with: | |
ci_workflows: "CI,Release" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ci: | |
name: Run CI workflow | |
needs: | |
- check-ci-runs | |
if: ${{ needs.check-ci-runs.outputs.ci_required == 1 }} | |
uses: ./.github/workflows/ci.yml | |
release: | |
name: Build phar and create draft release | |
needs: | |
- ci | |
if: ${{ !cancelled() && !failure() }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup PHP and Composer | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "8.3" | |
coverage: none | |
- name: Get Composer cache directory | |
id: get-composer-cache | |
shell: bash | |
run: printf 'cache_dir=%s\n' "$(composer config cache-files-dir)" >>"$GITHUB_OUTPUT" | |
- name: Cache PHP dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.get-composer-cache.outputs.cache_dir }} | |
key: composer-cache-${{ runner.os }}-${{ hashFiles('**/composer.json', '**/composer.lock') }} | |
restore-keys: composer-cache-${{ runner.os }}- | |
- name: Install PHP dependencies | |
run: composer install --no-interaction --no-progress | |
- name: Run build script | |
run: | | |
scripts/build.sh ${{ github.ref_name }} | |
{ printf 'artifact_name=%s\n' "${GITHUB_REPOSITORY##*/}" && | |
printf 'artifact_path=%s\n' build/dist/* | head -n1; } >>"$GITHUB_ENV" | |
- name: Sign phar | |
run: | | |
gpg --batch --import <<<"$GPG_KEY" | |
gpg --batch --pinentry-mode loopback --passphrase-fd 0 --detach-sign --local-user [email protected] --armor --output ${{ env.artifact_path }}.asc ${{ env.artifact_path }} <<<"$GPG_PASSPHRASE" | |
env: | |
GPG_KEY: ${{ secrets.GPG_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Create draft release or update existing release | |
run: | | |
${{ env.artifact_path }} --version | grep -F '${{ env.artifact_name }} ${{ github.ref_name }} (' | |
gh release view ${{ github.ref_name }} --json 'tagName,isDraft,assets' || | |
gh release create ${{ github.ref_name }} --draft --generate-notes --verify-tag | |
gh release upload ${{ github.ref_name }} ${{ env.artifact_path }} ${{ env.artifact_path }}.asc --clobber | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |