|
| 1 | +name: "Configure tokens for private packages and install PHP Dependencies with Composer using optionally dependencies.json" |
| 2 | +author: 'Ibexa AS' |
| 3 | +description: >- |
| 4 | + Configures GitHub App tokens and installs PHP dependencies using Composer. |
| 5 | + If a dependencies.json file is present, it updates composer.json accordingly before installation. |
| 6 | +
|
| 7 | +inputs: |
| 8 | + gh-client-id: |
| 9 | + description: 'GitHub App ID' |
| 10 | + required: true |
| 11 | + gh-client-secret: |
| 12 | + description: 'GitHub App ID' |
| 13 | + required: true |
| 14 | + satis-network-key: |
| 15 | + description: 'Satis Network Key' |
| 16 | + required: false |
| 17 | + satis-network-token: |
| 18 | + description: 'Satis Network Token' |
| 19 | + required: false |
| 20 | + php-extensions: |
| 21 | + description: 'Comma-separated list of PHP extensions to install' |
| 22 | + required: false |
| 23 | + default: 'pdo_sqlite, gd' |
| 24 | + |
| 25 | +runs: |
| 26 | + using: "composite" |
| 27 | + steps: |
| 28 | + - uses: actions/create-github-app-token@v2 |
| 29 | + id: generate_token |
| 30 | + with: |
| 31 | + app-id: ${{ inputs.gh-client-id }} |
| 32 | + private-key: ${{ inputs.gh-client-secret }} |
| 33 | + owner: ${{ github.repository_owner }} |
| 34 | + |
| 35 | + - name: Setup PHP Action |
| 36 | + uses: shivammathur/setup-php@v2 |
| 37 | + with: |
| 38 | + php-version: ${{ matrix.php }} |
| 39 | + coverage: none |
| 40 | + extensions: ${{ inputs.php-extensions }} |
| 41 | + tools: cs2pr |
| 42 | + |
| 43 | + - if: ${{ inputs.satis-network-key != '' && inputs.satis-network-token != '' }} |
| 44 | + name: Add composer keys for private packagist |
| 45 | + shell: bash |
| 46 | + run: composer config http-basic.updates.ibexa.co $SATIS_NETWORK_KEY $SATIS_NETWORK_TOKEN |
| 47 | + env: |
| 48 | + SATIS_NETWORK_KEY: ${{ inputs.satis-network-key }} |
| 49 | + SATIS_NETWORK_TOKEN: ${{ inputs.satis-network-token }} |
| 50 | + |
| 51 | + - if: steps.generate_token.outputs.token != '' |
| 52 | + name: Add composer key for GitHub App |
| 53 | + shell: bash |
| 54 | + run: composer config github-oauth.github.com $GITHUB_TOKEN |
| 55 | + env: |
| 56 | + GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} |
| 57 | + |
| 58 | + - name: 'Process dependencies.json and update composer.json' |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + if [[ -f dependencies.json ]] |
| 62 | + then |
| 63 | + "${GITHUB_ACTION_PATH}/composer-replace-dependencies.bash" dependencies.json |
| 64 | + fi |
| 65 | + env: |
| 66 | + GITHUB_ACTION_PATH: ${{ github.action_path }} |
| 67 | + |
| 68 | + - uses: ramsey/composer-install@v3 |
| 69 | + with: |
| 70 | + dependency-versions: highest |
0 commit comments