Skip to content

Commit b32718d

Browse files
committed
chore: Update workflows from nextcloud/.github
Signed-off-by: Benjamin Frueh <benjamin.frueh@gmail.com>
1 parent 18a98be commit b32718d

15 files changed

Lines changed: 221 additions & 102 deletions

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

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
release:
1313
types: [published]
1414

15+
permissions:
16+
contents: write
17+
1518
jobs:
1619
build_and_publish:
1720
runs-on: ubuntu-latest
@@ -32,13 +35,25 @@ jobs:
3235
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3336
3437
- name: Checkout
35-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
38+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3639
with:
40+
persist-credentials: false
3741
path: ${{ env.APP_NAME }}
3842

43+
- name: Get app version number
44+
id: app-version
45+
uses: skjnldsv/xpath-action@f5b036e9d973f42c86324833fd00be90665fbf77 # v1.0.0
46+
with:
47+
filename: ${{ env.APP_NAME }}/appinfo/info.xml
48+
expression: "//info//version/text()"
49+
50+
- name: Validate app version against tag
51+
run: |
52+
[ "${{ env.APP_VERSION }}" = "v${{ fromJSON(steps.app-version.outputs.result).version }}" ]
53+
3954
- name: Get appinfo data
4055
id: appinfo
41-
uses: skjnldsv/xpath-action@7e6a7c379d0e9abc8acaef43df403ab4fc4f770c # master
56+
uses: skjnldsv/xpath-action@f5b036e9d973f42c86324833fd00be90665fbf77 # v1.0.0
4257
with:
4358
filename: ${{ env.APP_NAME }}/appinfo/info.xml
4459
expression: "//info//dependencies//nextcloud/@min-version"
@@ -50,13 +65,13 @@ jobs:
5065
continue-on-error: true
5166
with:
5267
path: ${{ env.APP_NAME }}
53-
fallbackNode: '^20'
54-
fallbackNpm: '^10'
68+
fallbackNode: '^24'
69+
fallbackNpm: '^11.3'
5570

5671
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
5772
# Skip if no package.json
5873
if: ${{ steps.versions.outputs.nodeVersion }}
59-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
74+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
6075
with:
6176
node-version: ${{ steps.versions.outputs.nodeVersion }}
6277

@@ -67,12 +82,12 @@ jobs:
6782

6883
- name: Get php version
6984
id: php-versions
70-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
85+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
7186
with:
7287
filename: ${{ env.APP_NAME }}/appinfo/info.xml
7388

7489
- name: Set up php ${{ steps.php-versions.outputs.php-min }}
75-
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
90+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
7691
with:
7792
php-version: ${{ steps.php-versions.outputs.php-min }}
7893
coverage: none
@@ -125,22 +140,31 @@ jobs:
125140
cd ${{ env.APP_NAME }}
126141
make appstore
127142
128-
- name: Checkout server ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
129-
continue-on-error: true
130-
id: server-checkout
143+
- name: Check server download link for ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
131144
run: |
132145
NCVERSION='${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
133-
wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
134-
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
135157
136158
- name: Checkout server master fallback
137-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
138-
if: ${{ steps.server-checkout.outcome != 'success' }}
159+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
160+
if: ${{ steps.server-download.outcome != 'success' }}
139161
with:
162+
persist-credentials: false
140163
submodules: true
141164
repository: nextcloud/server
142165
path: nextcloud
143166

167+
144168
- name: Sign app
145169
run: |
146170
# Extracting release
@@ -157,7 +181,7 @@ jobs:
157181
tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
158182
159183
- name: Attach tarball to github release
160-
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
184+
uses: svenstaro/upload-release-action@6b7fa9f267e90b50a19fef07b3596790bb941741 # v2.11.3
161185
id: attach_to_release
162186
with:
163187
repo_token: ${{ secrets.GITHUB_TOKEN }}
@@ -167,7 +191,7 @@ jobs:
167191
overwrite: true
168192

169193
- name: Upload app to Nextcloud appstore
170-
uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1
194+
uses: nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1.0.3
171195
with:
172196
app_name: ${{ env.APP_NAME }}
173197
appstore_token: ${{ secrets.APPSTORE_TOKEN }}

.github/workflows/cypress.yml

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ env:
2424
# n.b. server will use head_ref, as we want to test the PR branch.
2525
BRANCH: ${{ github.base_ref || github.ref_name }}
2626

27+
28+
permissions:
29+
contents: read
30+
2731
jobs:
2832
init:
29-
runs-on: ubuntu-latest-low
33+
runs-on: ubuntu-latest
3034
outputs:
3135
nodeVersion: ${{ steps.versions.outputs.nodeVersion }}
3236
npmVersion: ${{ steps.versions.outputs.npmVersion }}
@@ -42,13 +46,15 @@ jobs:
4246
exit 1
4347
4448
- name: Checkout app
45-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
49+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
50+
with:
51+
persist-credentials: false
4652

4753
- name: Check composer.json
4854
id: check_composer
4955
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
5056
with:
51-
files: "composer.json"
57+
files: 'composer.json'
5258

5359
- name: Install composer dependencies
5460
if: steps.check_composer.outputs.files_exists == 'true'
@@ -58,11 +64,11 @@ jobs:
5864
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
5965
id: versions
6066
with:
61-
fallbackNode: "^20"
62-
fallbackNpm: "^10"
67+
fallbackNode: '^24'
68+
fallbackNpm: '^11.3'
6369

6470
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
65-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
71+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
6672
with:
6773
node-version: ${{ steps.versions.outputs.nodeVersion }}
6874

@@ -75,7 +81,7 @@ jobs:
7581
TESTING=true npm run build --if-present
7682
7783
- name: Save context
78-
uses: buildjet/cache/save@v4
84+
uses: buildjet/cache/save@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
7985
with:
8086
key: cypress-context-${{ github.run_id }}
8187
path: ./
@@ -89,28 +95,28 @@ jobs:
8995
matrix:
9096
# Run multiple copies of the current job in parallel
9197
# Please increase the number or runners as your tests suite grows
92-
containers: [1]
98+
containers: ['component', '1', '2', '3']
9399

94100
name: runner ${{ matrix.containers }}
95101

96102
steps:
97103
- name: Restore context
98-
uses: buildjet/cache/restore@v4
104+
uses: buildjet/cache/restore@3e70d19e31d6a8030aeddf6ed8dbe601f94d09f4 # v4.0.2
99105
with:
100106
fail-on-cache-miss: true
101107
key: cypress-context-${{ github.run_id }}
102108
path: ./
103109

104110
- name: Set up node ${{ needs.init.outputs.nodeVersion }}
105-
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
111+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
106112
with:
107113
node-version: ${{ needs.init.outputs.nodeVersion }}
108114

109115
- name: Set up npm ${{ needs.init.outputs.npmVersion }}
110116
run: npm i -g 'npm@${{ needs.init.outputs.npmVersion }}'
111117

112118
- name: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }} cypress tests
113-
uses: cypress-io/github-action@0da3c06ed8217b912deea9d8ee69630baed1737e # v6.7.6
119+
uses: cypress-io/github-action@e44ee0fa67251ab7e2d854d85b3a466577f47d14 # v7.1.3
114120
with:
115121
record: ${{ secrets.CYPRESS_RECORD_KEY && true }}
116122
parallel: ${{ secrets.CYPRESS_RECORD_KEY && true }}
@@ -133,7 +139,7 @@ jobs:
133139
CYPRESS_GROUP: Run ${{ matrix.containers == 'component' && 'component' || 'E2E' }}
134140

135141
- name: Upload snapshots
136-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
142+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
137143
if: always()
138144
with:
139145
name: snapshots_${{ matrix.containers }}
@@ -144,7 +150,7 @@ jobs:
144150
run: docker logs nextcloud-cypress-tests-${{ env.APP_NAME }} > nextcloud.log
145151

146152
- name: Upload NC logs
147-
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
153+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
148154
if: failure() && matrix.containers != 'component'
149155
with:
150156
name: nc_logs_${{ matrix.containers }}

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

Lines changed: 18 additions & 9 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_target:
12+
pull_request_target: # zizmor: ignore[dangerous-triggers]
1313
branches:
1414
- main
1515
- master
@@ -24,11 +24,13 @@ concurrency:
2424

2525
jobs:
2626
auto-approve-merge:
27-
if: github.actor == 'dependabot[bot]' || github.actor == 'renovate[bot]'
27+
if: github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]'
2828
runs-on: ubuntu-latest-low
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-info-xml.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
name: info.xml lint
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
with:
29+
persist-credentials: false
2830

2931
- name: Download schema
3032
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,28 @@ jobs:
2525

2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
28+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
29+
with:
30+
persist-credentials: false
2931

3032
- name: Get php version
3133
id: versions
32-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
34+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3335

34-
- name: Set up php${{ steps.versions.outputs.php-available }}
35-
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
36+
- name: Set up php${{ steps.versions.outputs.php-min }}
37+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
3638
with:
37-
php-version: ${{ steps.versions.outputs.php-available }}
39+
php-version: ${{ steps.versions.outputs.php-min }}
3840
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
3941
coverage: none
4042
ini-file: development
4143
env:
4244
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4345

4446
- name: Install dependencies
45-
run: composer i
47+
run: |
48+
composer remove nextcloud/ocp --dev --no-scripts
49+
composer i
4650
4751
- name: Lint
4852
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.github/workflows/lint-php.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ jobs:
2424
php-versions: ${{ steps.versions.outputs.php-versions }}
2525
steps:
2626
- name: Checkout app
27-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
with:
29+
persist-credentials: false
30+
2831
- name: Get version matrix
2932
id: versions
30-
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
33+
uses: icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
3134

3235
php-lint:
3336
runs-on: ubuntu-latest
@@ -40,10 +43,12 @@ jobs:
4043

4144
steps:
4245
- name: Checkout
43-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
46+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
47+
with:
48+
persist-credentials: false
4449

4550
- name: Set up php ${{ matrix.php-versions }}
46-
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
51+
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2.36.0
4752
with:
4853
php-version: ${{ matrix.php-versions }}
4954
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)