|
| 1 | +name: Build Preview Zip |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [ 'opened', 'synchronize', 'reopened', 'edited' ] |
| 6 | + |
| 7 | +# Cancels all previous workflow runs for pull requests that have not completed. |
| 8 | +concurrency: |
| 9 | + # The concurrency group contains the workflow name and the branch name for pull requests |
| 10 | + # or the commit hash for any other events. |
| 11 | + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +# Disable permissions for all available scopes by default. |
| 15 | +# Any needed permissions should be configured at the job level. |
| 16 | +permissions: {} |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + contents: read |
| 23 | + outputs: |
| 24 | + job_status: ${{ job.status }} |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout code |
| 28 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 29 | + with: |
| 30 | + show-progress: ${{ runner.debug == '1' && 'true' || 'false' }} |
| 31 | + persist-credentials: false |
| 32 | + |
| 33 | + - name: Set up PHP |
| 34 | + uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2.37.1 |
| 35 | + with: |
| 36 | + php-version: '7.4' |
| 37 | + coverage: none |
| 38 | + |
| 39 | + - name: Use desired version of Node.js |
| 40 | + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 41 | + with: |
| 42 | + node-version-file: '.nvmrc' |
| 43 | + check-latest: true |
| 44 | + |
| 45 | + - name: Install NPM dependencies |
| 46 | + run: npm ci |
| 47 | + |
| 48 | + - name: Install Composer dependencies |
| 49 | + uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # v4.0.0 |
| 50 | + with: |
| 51 | + composer-options: '--no-dev -o' |
| 52 | + |
| 53 | + - name: Build plugin |
| 54 | + run: | |
| 55 | + npm run build |
| 56 | + npm run makepot |
| 57 | + npm run archive |
| 58 | +
|
| 59 | + - name: Upload artifact |
| 60 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 61 | + with: |
| 62 | + name: classifai-zip-pr${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} |
| 63 | + path: classifai.zip |
| 64 | + if-no-files-found: error |
0 commit comments