Skip to content

Commit 970772f

Browse files
committed
Extracted ./ibexa/gh-workflows/actions/prepare-composer action
1 parent e1e0420 commit 970772f

File tree

3 files changed

+80
-42
lines changed

3 files changed

+80
-42
lines changed
Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: "Configure tokens for private packages and install PHP Dependencies with Composer using optionally dependencies.json"
1+
name: "Prepare composer using ./ibexa/gh-workflows/actions/prepare-composer action and execute composer install"
22
author: 'Ibexa AS'
33
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.
4+
Runs ./ibexa/gh-workflows/actions/prepare-composer action with the same input
5+
and then runs ramsey/composer-install action
66
77
inputs:
88
gh-client-id:
@@ -21,50 +21,22 @@ inputs:
2121
description: 'Comma-separated list of PHP extensions to install'
2222
required: false
2323
default: 'pdo_sqlite, gd'
24+
dependency-versions:
25+
description: 'Dependency version resolution strategy (lowest, highest, or locked)'
26+
required: false
27+
default: 'highest'
2428

2529
runs:
2630
using: "composite"
2731
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
32+
- uses: ./actions/prepare-composer
3733
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 }}
34+
gh-client-id: ${{ inputs.gh-client-id }}
35+
gh-client-secret: ${{ inputs.gh-client-secret }}
36+
satis-network-key: ${{ inputs.satis-network-key }}
37+
satis-network-token: ${{ inputs.satis-network-token }}
38+
php-extensions: ${{ inputs.php-extensions }}
6739

6840
- uses: ramsey/composer-install@v3
6941
with:
70-
dependency-versions: highest
42+
dependency-versions: ${{ inputs.dependency-versions }}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Configure PHP, tokens for private packages, and GitHub OAuth token. Optionally use dependencies.json for dev versions of packages"
2+
author: 'Ibexa AS'
3+
description: >-
4+
Configures Composer GitHub App tokens and Satis network keys.
5+
If a dependencies.json file is present, it updates composer.json accordingly.
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 }}

0 commit comments

Comments
 (0)