Skip to content

Commit 0816e4b

Browse files
Merge pull request #699 from nextcloud/feat/noid/support-composer-bin
feat(nextcloud-ocp): Support composer-bin usage for nextcloud-ocp pac…
2 parents 754d8a3 + 7a3f16a commit 0816e4b

2 files changed

Lines changed: 49 additions & 55 deletions

File tree

workflow-templates/update-nextcloud-ocp-matrix.yml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,25 @@ jobs:
5959
- name: Composer install
6060
run: composer install
6161

62+
- name: Check composer bin for nextcloud/ocp exists
63+
id: check_composer_bin
64+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
65+
with:
66+
files: vendor-bin/nextcloud-ocp/composer.json
67+
6268
- name: Composer update nextcloud/ocp
6369
id: update_branch
64-
run: composer require --dev nextcloud/ocp:dev-${{ steps.versions.outputs.branches-min }}
70+
env:
71+
USE_COMPOSER_BIN: ${{ steps.check_composer_bin.outputs.files_exists }}
72+
BRANCH_NAME: ${{ steps.versions.outputs.branches-min }}
73+
run: |
74+
COMPOSER_CMD='composer'
75+
if [[ "$USE_COMPOSER_BIN" == 'true' ]]; then
76+
COMPOSER_CMD='composer bin nextcloud-ocp'
77+
fi
78+
79+
echo $COMPOSER_CMD require --dev nextcloud/ocp:dev-$BRANCH_NAME
80+
$COMPOSER_CMD require --dev nextcloud/ocp:dev-$BRANCH_NAME
6581
6682
- name: Raise on issue on failure
6783
uses: dacbd/create-issue-action@cdb57ab6ff8862aa09fee2be6ba77a59581921c2 # v2.0.0
@@ -71,24 +87,6 @@ jobs:
7187
title: 'Failed to update nextcloud/ocp package'
7288
body: 'Please check the output of the GitHub action and manually resolve the issues<br>${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}<br>${{ steps.codeowners.outputs.codeowners }}'
7389

74-
- name: Reset checkout 3rdparty
75-
run: |
76-
git clean -f 3rdparty
77-
git checkout 3rdparty
78-
continue-on-error: true
79-
80-
- name: Reset checkout vendor
81-
run: |
82-
git clean -f vendor
83-
git checkout vendor
84-
continue-on-error: true
85-
86-
- name: Reset checkout vendor-bin
87-
run: |
88-
git clean -f vendor-bin
89-
git checkout vendor-bin
90-
continue-on-error: true
91-
9290
- name: Create Pull Request
9391
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
9492
with:
@@ -99,6 +97,11 @@ jobs:
9997
signoff: true
10098
branch: 'automated/noid/${{ matrix.branches }}-update-nextcloud-ocp'
10199
title: '[${{ matrix.branches }}] Update nextcloud/ocp dependency'
100+
add-path: |
101+
composer.json
102+
composer.lock
103+
vendor-bin/nextcloud-ocp/composer.json
104+
vendor-bin/nextcloud-ocp/composer.lock
102105
body: |
103106
Auto-generated update of [nextcloud/ocp](https://github.com/nextcloud-deps/ocp/) dependency
104107
labels: |

workflow-templates/update-nextcloud-ocp.yml

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -62,53 +62,39 @@ jobs:
6262
if: steps.checkout.outcome == 'success'
6363
run: composer install
6464

65-
- name: Composer update nextcloud/ocp # zizmor: ignore[template-injection]
66-
id: update_branch
67-
if: ${{ steps.checkout.outcome == 'success' && matrix.branches != 'main' }}
68-
run: composer require --dev 'nextcloud/ocp:dev-${{ matrix.branches }}'
69-
70-
- name: Raise on issue on failure
71-
uses: dacbd/create-issue-action@cdb57ab6ff8862aa09fee2be6ba77a59581921c2 # v2.0.0
72-
if: ${{ steps.checkout.outcome == 'success' && failure() && steps.update_branch.conclusion == 'failure' }}
65+
- name: Check composer bin for nextcloud/ocp exists
66+
id: check_composer_bin
67+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
7368
with:
74-
token: ${{ secrets.GITHUB_TOKEN }}
75-
title: 'Failed to update nextcloud/ocp package on branch ${{ matrix.branches }}'
76-
body: 'Please check the output of the GitHub action and manually resolve the issues<br>${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}<br>${{ steps.codeowners.outputs.codeowners }}'
69+
files: vendor-bin/nextcloud-ocp/composer.json
7770

7871
- name: Composer update nextcloud/ocp
79-
id: update_main
80-
if: ${{ steps.checkout.outcome == 'success' && matrix.branches == 'main' }}
81-
run: composer require --dev nextcloud/ocp:dev-master
72+
id: update_branch
73+
env:
74+
USE_COMPOSER_BIN: ${{ steps.check_composer_bin.outputs.files_exists }}
75+
BRANCH_NAME: ${{ matrix.branches }}
76+
run: |
77+
COMPOSER_CMD='composer'
78+
if [[ "$USE_COMPOSER_BIN" == 'true' ]]; then
79+
COMPOSER_CMD='composer bin nextcloud-ocp'
80+
fi
81+
82+
PACKAGE_VERSION="nextcloud/ocp:dev-$BRANCH_NAME"
83+
if [[ "$BRANCH_NAME" == 'main' ]]; then
84+
PACKAGE_VERSION='nextcloud/ocp:dev-master'
85+
fi
86+
87+
echo $COMPOSER_CMD require --dev $PACKAGE_VERSION
88+
$COMPOSER_CMD require --dev $PACKAGE_VERSION
8289
8390
- name: Raise on issue on failure
8491
uses: dacbd/create-issue-action@cdb57ab6ff8862aa09fee2be6ba77a59581921c2 # v2.0.0
85-
if: ${{ steps.checkout.outcome == 'success' && failure() && steps.update_main.conclusion == 'failure' }}
92+
if: ${{ steps.checkout.outcome == 'success' && failure() && steps.update_branch.conclusion == 'failure' }}
8693
with:
8794
token: ${{ secrets.GITHUB_TOKEN }}
8895
title: 'Failed to update nextcloud/ocp package on branch ${{ matrix.branches }}'
8996
body: 'Please check the output of the GitHub action and manually resolve the issues<br>${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}<br>${{ steps.codeowners.outputs.codeowners }}'
9097

91-
- name: Reset checkout 3rdparty
92-
if: steps.checkout.outcome == 'success'
93-
run: |
94-
git clean -f 3rdparty
95-
git checkout 3rdparty
96-
continue-on-error: true
97-
98-
- name: Reset checkout vendor
99-
if: steps.checkout.outcome == 'success'
100-
run: |
101-
git clean -f vendor
102-
git checkout vendor
103-
continue-on-error: true
104-
105-
- name: Reset checkout vendor-bin
106-
if: steps.checkout.outcome == 'success'
107-
run: |
108-
git clean -f vendor-bin
109-
git checkout vendor-bin
110-
continue-on-error: true
111-
11298
- name: Create Pull Request
11399
if: steps.checkout.outcome == 'success'
114100
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
@@ -120,6 +106,11 @@ jobs:
120106
signoff: true
121107
branch: 'automated/noid/${{ matrix.branches }}-update-nextcloud-ocp'
122108
title: '[${{ matrix.branches }}] Update nextcloud/ocp dependency'
109+
add-path: |
110+
composer.json
111+
composer.lock
112+
vendor-bin/nextcloud-ocp/composer.json
113+
vendor-bin/nextcloud-ocp/composer.lock
123114
body: |
124115
Auto-generated update of [nextcloud/ocp](https://github.com/nextcloud-deps/ocp/) dependency
125116
labels: |

0 commit comments

Comments
 (0)