Skip to content

Commit 792557b

Browse files
authored
Merge pull request #1033 from nextcloud/chore/update-workflows
chore: Update workflows from templates
2 parents b1bd15e + 2c1ae9d commit 792557b

20 files changed

Lines changed: 180 additions & 107 deletions

.github/workflows/appstore-build-publish.yml

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ jobs:
3535
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3636
3737
- name: Checkout
38-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3939
with:
4040
persist-credentials: false
4141
path: ${{ env.APP_NAME }}
4242

4343
- name: Get app version number
4444
id: app-version
45-
uses: skjnldsv/xpath-action@7e6a7c379d0e9abc8acaef43df403ab4fc4f770c # master
45+
uses: skjnldsv/xpath-action@f5b036e9d973f42c86324833fd00be90665fbf77 # v1.0.0
4646
with:
4747
filename: ${{ env.APP_NAME }}/appinfo/info.xml
4848
expression: "//info//version/text()"
@@ -53,7 +53,7 @@ jobs:
5353
5454
- name: Get appinfo data
5555
id: appinfo
56-
uses: skjnldsv/xpath-action@7e6a7c379d0e9abc8acaef43df403ab4fc4f770c # master
56+
uses: skjnldsv/xpath-action@f5b036e9d973f42c86324833fd00be90665fbf77 # v1.0.0
5757
with:
5858
filename: ${{ env.APP_NAME }}/appinfo/info.xml
5959
expression: "//info//dependencies//nextcloud/@min-version"
@@ -65,13 +65,13 @@ jobs:
6565
continue-on-error: true
6666
with:
6767
path: ${{ env.APP_NAME }}
68-
fallbackNode: '^20'
69-
fallbackNpm: '^10'
68+
fallbackNode: '^24'
69+
fallbackNpm: '^11.3'
7070

7171
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
7272
# Skip if no package.json
7373
if: ${{ steps.versions.outputs.nodeVersion }}
74-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
74+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
7575
with:
7676
node-version: ${{ steps.versions.outputs.nodeVersion }}
7777

@@ -87,7 +87,7 @@ jobs:
8787
filename: ${{ env.APP_NAME }}/appinfo/info.xml
8888

8989
- name: Set up php ${{ steps.php-versions.outputs.php-min }}
90-
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
90+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
9191
with:
9292
php-version: ${{ steps.php-versions.outputs.php-min }}
9393
coverage: none
@@ -140,23 +140,31 @@ jobs:
140140
cd ${{ env.APP_NAME }}
141141
make appstore
142142
143-
- name: Checkout server ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
144-
continue-on-error: true
145-
id: server-checkout
143+
- name: Check server download link for ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
146144
run: |
147145
NCVERSION='${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
148-
wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
149-
unzip latest-$NCVERSION.zip
146+
DOWNLOAD_URL=$(curl -s "https://updates.nextcloud.com/updater_server/latest?channel=beta&version=$NCVERSION" | jq -r '.downloads.zip[0]')
147+
echo "DOWNLOAD_URL=$DOWNLOAD_URL" >> $GITHUB_ENV
148+
149+
- name: Download server ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
150+
continue-on-error: true
151+
id: server-download
152+
if: ${{ env.DOWNLOAD_URL != 'null' }}
153+
run: |
154+
echo "Downloading release tarball from $DOWNLOAD_URL"
155+
wget $DOWNLOAD_URL -O nextcloud.zip
156+
unzip nextcloud.zip
150157
151158
- name: Checkout server master fallback
152-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
153-
if: ${{ steps.server-checkout.outcome != 'success' }}
159+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
160+
if: ${{ steps.server-download.outcome != 'success' }}
154161
with:
155162
persist-credentials: false
156163
submodules: true
157164
repository: nextcloud/server
158165
path: nextcloud
159166

167+
160168
- name: Sign app
161169
run: |
162170
# Extracting release
@@ -173,7 +181,7 @@ jobs:
173181
tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
174182
175183
- name: Attach tarball to github release
176-
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
184+
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # v2.11.3
177185
id: attach_to_release
178186
with:
179187
repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -183,7 +191,7 @@ jobs:
183191
overwrite: true
184192

185193
- name: Upload app to Nextcloud appstore
186-
uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1
194+
uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1.0.3
187195
with:
188196
app_name: ${{ env.APP_NAME }}
189197
appstore_token: ${{ secrets.APPSTORE_TOKEN }}

.github/workflows/command-compile.yml

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ permissions:
1616

1717
jobs:
1818
init:
19-
runs-on: ubuntu-latest
19+
runs-on: ubuntu-latest-low
2020

2121
# On pull requests and if the comment starts with `/compile`
2222
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/compile')
@@ -30,7 +30,7 @@ jobs:
3030

3131
steps:
3232
- name: Get repository from pull request comment
33-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
33+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
3434
id: get-repository
3535
with:
3636
github-token: ${{secrets.GITHUB_TOKEN}}
@@ -57,7 +57,7 @@ jobs:
5757
require: write
5858

5959
- name: Add reaction on start
60-
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
60+
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
6161
with:
6262
token: ${{ secrets.COMMAND_BOT_PAT }}
6363
repository: ${{ github.event.repository.full_name }}
@@ -83,7 +83,7 @@ jobs:
8383
id: comment-branch
8484

8585
- name: Add reaction on failure
86-
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
86+
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
8787
if: failure()
8888
with:
8989
token: ${{ secrets.COMMAND_BOT_PAT }}
@@ -103,7 +103,7 @@ jobs:
103103
key: git-repo
104104

105105
- name: Checkout ${{ needs.init.outputs.head_ref }}
106-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
106+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
107107
with:
108108
# Needed to allow force push later
109109
persist-credentials: true
@@ -120,23 +120,57 @@ jobs:
120120
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
121121
id: package-engines-versions
122122
with:
123-
fallbackNode: '^20'
124-
fallbackNpm: '^10'
123+
fallbackNode: '^24'
124+
fallbackNpm: '^11.3'
125125

126126
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
127-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
127+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
128128
with:
129129
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
130130
cache: npm
131131

132132
- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
133133
run: npm i -g 'npm@${{ steps.package-engines-versions.outputs.npmVersion }}'
134-
134+
135135
- name: Rebase to ${{ needs.init.outputs.base_ref }}
136136
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
137137
run: |
138138
git fetch origin '${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}'
139-
git rebase 'origin/${{ needs.init.outputs.base_ref }}'
139+
140+
# Start the rebase
141+
git rebase 'origin/${{ needs.init.outputs.base_ref }}' || {
142+
# Handle rebase conflicts in a loop
143+
while [ -d .git/rebase-merge ] || [ -d .git/rebase-apply ]; do
144+
echo "Handling rebase conflict..."
145+
146+
# Remove and checkout /dist and /js folders from the base branch
147+
if [ -d "dist" ]; then
148+
rm -rf dist
149+
git checkout origin/${{ needs.init.outputs.base_ref }} -- dist/ 2>/dev/null || echo "No dist folder in base branch"
150+
fi
151+
if [ -d "js" ]; then
152+
rm -rf js
153+
git checkout origin/${{ needs.init.outputs.base_ref }} -- js/ 2>/dev/null || echo "No js folder in base branch"
154+
fi
155+
156+
# Stage all changes
157+
git add .
158+
159+
# Check if there are any changes after resolving conflicts
160+
if git diff --cached --quiet; then
161+
echo "No changes after conflict resolution, skipping commit"
162+
git rebase --skip
163+
else
164+
echo "Changes found, continuing rebase without editing commit message"
165+
git -c core.editor=true rebase --continue
166+
fi
167+
168+
# Break if rebase is complete
169+
if [ ! -d .git/rebase-merge ] && [ ! -d .git/rebase-apply ]; then
170+
break
171+
fi
172+
done
173+
}
140174
141175
- name: Install dependencies & build
142176
env:
@@ -151,7 +185,7 @@ jobs:
151185
run: |
152186
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
153187
git commit --signoff -m 'chore(assets): Recompile assets'
154-
188+
155189
- name: Commit fixup
156190
if: ${{ contains(needs.init.outputs.arg1, 'fixup') }}
157191
run: |
@@ -168,14 +202,18 @@ jobs:
168202
169203
- name: Push normally
170204
if: ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
171-
run: git push origin '${{ needs.init.outputs.head_ref }}'
205+
env:
206+
HEAD_REF: ${{ needs.init.outputs.head_ref }}
207+
run: git push origin "$HEAD_REF"
172208

173209
- name: Force push
174210
if: ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
175-
run: git push --force origin '${{ needs.init.outputs.head_ref }}'
211+
env:
212+
HEAD_REF: ${{ needs.init.outputs.head_ref }}
213+
run: git push --force-with-lease origin "$HEAD_REF"
176214

177215
- name: Add reaction on failure
178-
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
216+
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
179217
if: failure()
180218
with:
181219
token: ${{ secrets.COMMAND_BOT_PAT }}

.github/workflows/dependabot-approve-merge.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
# https://github.com/nextcloud/.github
44
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
55
#
6-
# SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
6+
# SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
77
# SPDX-License-Identifier: MIT
88

9-
name: Dependabot
9+
name: Auto approve Dependabot PRs
1010

1111
on:
12-
pull_request:
12+
pull_request_target: # zizmor: ignore[dangerous-triggers]
1313
branches:
1414
- main
1515
- master
@@ -29,6 +29,8 @@ jobs:
2929
permissions:
3030
# for hmarr/auto-approve-action to approve PRs
3131
pull-requests: write
32+
# for alexwilson/enable-github-automerge-action to approve PRs
33+
contents: write
3234

3335
steps:
3436
- name: Disabled on forks
@@ -37,13 +39,20 @@ jobs:
3739
echo 'Can not approve PRs from forks'
3840
exit 1
3941
42+
- uses: mdecoleman/pr-branch-name@55795d86b4566d300d237883103f052125cc7508 # v3.0.0
43+
id: branchname
44+
with:
45+
repo-token: ${{ secrets.GITHUB_TOKEN }}
46+
4047
# GitHub actions bot approve
41-
- uses: hmarr/auto-approve-action@b40d6c9ed2fa10c9a2749eca7eb004418a705501 # v2
48+
- uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0
49+
if: startsWith(steps.branchname.outputs.branch, 'dependabot/')
4250
with:
4351
github-token: ${{ secrets.GITHUB_TOKEN }}
4452

45-
# Nextcloud bot approve and merge request
46-
- uses: ahmadnassri/action-dependabot-auto-merge@45fc124d949b19b6b8bf6645b6c9d55f4f9ac61a # v2
53+
# Enable GitHub auto merge
54+
- name: Auto merge
55+
uses: alexwilson/enable-github-automerge-action@56e3117d1ae1540309dc8f7a9f2825bc3c5f06ff # v2.0.0
56+
if: startsWith(steps.branchname.outputs.branch, 'dependabot/')
4757
with:
48-
target: minor
49-
github-token: ${{ secrets.DEPENDABOT_AUTOMERGE_TOKEN }}
58+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint-eslint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,19 @@ jobs:
5656

5757
steps:
5858
- name: Checkout
59-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
59+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
6060
with:
6161
persist-credentials: false
6262

6363
- name: Read package.json node and npm engines version
6464
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
6565
id: versions
6666
with:
67-
fallbackNode: '^20'
68-
fallbackNpm: '^10'
67+
fallbackNode: '^24'
68+
fallbackNpm: '^11.3'
6969

7070
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
71-
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
71+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
7272
with:
7373
node-version: ${{ steps.versions.outputs.nodeVersion }}
7474

.github/workflows/lint-info-xml.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
name: info.xml lint
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2828
with:
2929
persist-credentials: false
3030

.github/workflows/lint-php-cs.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2929
with:
3030
persist-credentials: false
3131

@@ -34,7 +34,7 @@ jobs:
3434
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
3535

3636
- name: Set up php${{ steps.versions.outputs.php-min }}
37-
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
37+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
3838
with:
3939
php-version: ${{ steps.versions.outputs.php-min }}
4040
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
@@ -45,7 +45,7 @@ jobs:
4545

4646
- name: Install dependencies
4747
run: |
48-
composer remove nextcloud/ocp --dev
48+
composer remove nextcloud/ocp --dev --no-scripts
4949
composer i
5050
5151
- name: Lint

.github/workflows/lint-php.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
php-versions: ${{ steps.versions.outputs.php-versions }}
2525
steps:
2626
- name: Checkout app
27-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2828
with:
2929
persist-credentials: false
3030

@@ -43,12 +43,12 @@ jobs:
4343

4444
steps:
4545
- name: Checkout
46-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
46+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4747
with:
4848
persist-credentials: false
4949

5050
- name: Set up php ${{ matrix.php-versions }}
51-
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
51+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
5252
with:
5353
php-version: ${{ matrix.php-versions }}
5454
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

0 commit comments

Comments
 (0)