|
1 | 1 | # This is a basic workflow to help you get started with Actions
|
2 |
| - |
3 | 2 | on:
|
4 |
| - release: |
5 |
| - types: [created] |
| 3 | + push: |
| 4 | + branches: [ master ] |
| 5 | + pull_request: |
| 6 | + release: |
| 7 | + types: [ created ] |
6 | 8 |
|
7 | 9 | name: Release workflow
|
8 | 10 |
|
9 | 11 | jobs:
|
10 | 12 | release:
|
11 | 13 | runs-on: ubuntu-latest
|
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - php: 7.4 |
| 19 | + tools: "composer:v2" |
| 20 | + coverage: "none" |
| 21 | + git-fetch-depth: 1 |
12 | 22 | steps:
|
13 | 23 | - name: Checkout code
|
14 | 24 | uses: actions/checkout@master
|
15 |
| - - name: Install dependencies |
16 |
| - uses: php-actions/composer@v4 |
| 25 | + - name: Setup PHP |
| 26 | + uses: shivammathur/setup-php@v2 |
17 | 27 | with:
|
18 |
| - command: global require humbug/box |
19 |
| - - name: build |
20 |
| - run: box compile |
21 |
| - - name: Upload the phar |
22 |
| - uses: skx/github-action-publish-binaries@master |
23 |
| - env: |
24 |
| - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + php-version: ${{ matrix.php }} |
| 29 | + ini-values: "phar.readonly=0" |
| 30 | + tools: ${{ matrix.tools }} |
| 31 | + coverage: ${{ matrix.coverage }} |
| 32 | + extensions: ctype, iconv, xml |
| 33 | + |
| 34 | + - name: Get composer cache directory |
| 35 | + id: composercache |
| 36 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 37 | + |
| 38 | + - name: Cache composer dependencies |
| 39 | + uses: actions/cache@v2 |
25 | 40 | with:
|
26 |
| - args: '/bin/*.phar' |
| 41 | + path: ${{ steps.composercache.outputs.dir }} |
| 42 | + key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('composer.*') }} |
| 43 | + restore-keys: | |
| 44 | + composer-${{ runner.os }}-${{ matrix.php-version }}- |
| 45 | + composer-${{ runner.os }}- |
| 46 | + composer- |
| 47 | + - name: Install dependencies |
| 48 | + run: composer require humbug/box --dev |
| 49 | + - name: Build phar |
| 50 | + run: composer run box compile |
| 51 | + - uses: actions/upload-artifact@v1 |
| 52 | + name: Publish the PHAR |
| 53 | + with: |
| 54 | + name: phplint.phar |
| 55 | + path: bin/phplint.phar |
| 56 | + |
| 57 | + publish-phar: |
| 58 | + runs-on: ubuntu-latest |
| 59 | + name: Publish the PHAR |
| 60 | + if: github.event_name == 'release' |
| 61 | + steps: |
| 62 | + - uses: actions/download-artifact@v1 |
| 63 | + with: |
| 64 | + name: phplint.phar |
| 65 | + path: . |
| 66 | + |
| 67 | + - name: Upload phplint.phar |
| 68 | + uses: actions/upload-release-asset@v1 |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 71 | + with: |
| 72 | + upload_url: ${{ github.event.release.upload_url }} |
| 73 | + asset_path: phplint.phar |
| 74 | + asset_name: phplint.phar |
| 75 | + asset_content_type: application/zip |
0 commit comments