|
| 1 | +name: php-suite-api Build |
| 2 | + |
| 3 | +on: push |
| 4 | + |
| 5 | +env: |
| 6 | + PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }} |
| 7 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + name: Tests 🚦 |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Check out repository |
| 15 | + uses: actions/checkout@v3 |
| 16 | + - name: Use correct PHP version |
| 17 | + run: phpenv local 8.0 |
| 18 | + - name: Install dependencies |
| 19 | + run: composer install --no-interaction |
| 20 | + - name: Run tests |
| 21 | + run: composer test |
| 22 | + - name: Slack notification |
| 23 | + uses: 8398a7/action-slack@a189acbf0b7ea434558662ae25a0de71df69a435 |
| 24 | + if: ${{ failure() }} |
| 25 | + with: |
| 26 | + status: ${{ job.status }} |
| 27 | + fields: repo,message,author,job,ref |
| 28 | + job_name: Test 🚦 |
| 29 | + env: |
| 30 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 31 | + |
| 32 | + deploy: |
| 33 | + name: Deploy 🚢 |
| 34 | + needs: [test] |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - name: Check out repository |
| 38 | + uses: actions/checkout@v3 |
| 39 | + - name: Use correct PHP version |
| 40 | + run: phpenv local 8.0 |
| 41 | + - name: Release package |
| 42 | + if: github.ref_name == 'master' |
| 43 | + run: composer publish emartech ${PACKAGIST_TOKEN} |
| 44 | + - name: Slack notification |
| 45 | + uses: 8398a7/action-slack@a189acbf0b7ea434558662ae25a0de71df69a435 |
| 46 | + with: |
| 47 | + status: ${{ job.status }} |
| 48 | + fields: repo,message,author,job,ref |
| 49 | + job_name: Deploy 🚢 |
| 50 | + env: |
| 51 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 52 | + if: always() |
0 commit comments