Skip to content

Commit

Permalink
Update build-phar.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
overtrue authored Dec 11, 2020
1 parent 70beeee commit 1f70101
Showing 1 changed file with 62 additions and 13 deletions.
75 changes: 62 additions & 13 deletions .github/workflows/build-phar.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,75 @@
# This is a basic workflow to help you get started with Actions

on:
release:
types: [created]
push:
branches: [ master ]
pull_request:
release:
types: [ created ]

name: Release workflow

jobs:
release:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- php: 7.4
tools: "composer:v2"
coverage: "none"
git-fetch-depth: 1
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Install dependencies
uses: php-actions/composer@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
command: global require humbug/box
- name: build
run: box compile
- name: Upload the phar
uses: skx/github-action-publish-binaries@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
php-version: ${{ matrix.php }}
ini-values: "phar.readonly=0"
tools: ${{ matrix.tools }}
coverage: ${{ matrix.coverage }}
extensions: ctype, iconv, xml

- name: Get composer cache directory
id: composercache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
args: '/bin/*.phar'
path: ${{ steps.composercache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
- name: Install dependencies
run: composer require humbug/box --dev
- name: Build phar
run: composer run box compile
- uses: actions/upload-artifact@v1
name: Publish the PHAR
with:
name: phplint.phar
path: bin/phplint.phar

publish-phar:
runs-on: ubuntu-latest
name: Publish the PHAR
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v1
with:
name: phplint.phar
path: .

- name: Upload phplint.phar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: phplint.phar
asset_name: phplint.phar
asset_content_type: application/zip

0 comments on commit 1f70101

Please sign in to comment.