22#
33# https://github.com/nextcloud/.github
44# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5+ #
6+ # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
7+ # SPDX-License-Identifier: MIT
58
69name : Build and publish app release
710
811on :
912 release :
1013 types : [published]
1114
12- env :
13- PHP_VERSION : 8.2
15+ permissions :
16+ contents : write
1417
1518jobs :
1619 build_and_publish :
2124
2225 steps :
2326 - name : Check actor permission
24- uses : skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2.1
27+ uses : skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
2528 with :
2629 require : write
2730
@@ -32,50 +35,68 @@ jobs:
3235 echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3336
3437 - name : Checkout
35- uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5 .2
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"
4560
4661 - name : Read package.json node and npm engines version
47- uses : skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
62+ uses : skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
4863 id : versions
4964 # Continue if no package.json
5065 continue-on-error : true
5166 with :
5267 path : ${{ env.APP_NAME }}
53- fallbackNode : " ^16 "
54- fallbackNpm : " ^7 "
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@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
74+ uses : actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
6075 with :
6176 node-version : ${{ steps.versions.outputs.nodeVersion }}
6277
6378 - name : Set up npm ${{ steps.versions.outputs.npmVersion }}
6479 # Skip if no package.json
6580 if : ${{ steps.versions.outputs.npmVersion }}
66- run : npm i -g npm@" ${{ steps.versions.outputs.npmVersion }}"
81+ run : npm i -g ' npm@${{ steps.versions.outputs.npmVersion }}'
6782
68- - name : Set up php ${{ env.PHP_VERSION }}
69- uses : shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
83+ - name : Get php version
84+ id : php-versions
85+ uses : icewind1991/nextcloud-version-matrix@8a7bac6300b2f0f3100088b297995a229558ddba # v1.3.2
7086 with :
71- php-version : ${{ env.PHP_VERSION }}
87+ filename : ${{ env.APP_NAME }}/appinfo/info.xml
88+
89+ - name : Set up php ${{ steps.php-versions.outputs.php-min }}
90+ uses : shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # v2.37.0
91+ with :
92+ php-version : ${{ steps.php-versions.outputs.php-min }}
7293 coverage : none
7394 env :
7495 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7596
7697 - name : Check composer.json
7798 id : check_composer
78- uses : andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
99+ uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
79100 with :
80101 files : " ${{ env.APP_NAME }}/composer.json"
81102
@@ -88,14 +109,16 @@ jobs:
88109 - name : Build ${{ env.APP_NAME }}
89110 # Skip if no package.json
90111 if : ${{ steps.versions.outputs.nodeVersion }}
112+ env :
113+ CYPRESS_INSTALL_BINARY : 0
91114 run : |
92115 cd ${{ env.APP_NAME }}
93116 npm ci
94- npm run build
117+ npm run build --if-present
95118
96119 - name : Check Krankerl config
97120 id : krankerl
98- uses : andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
121+ uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
99122 with :
100123 files : ${{ env.APP_NAME }}/krankerl.toml
101124
@@ -117,30 +140,39 @@ jobs:
117140 cd ${{ env.APP_NAME }}
118141 make appstore
119142
120- - name : Checkout server ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
143+ - name : Check server download link for ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
144+ run : |
145+ NCVERSION='${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
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 }}
121150 continue-on-error : true
122- id : server-checkout
151+ id : server-download
152+ if : ${{ env.DOWNLOAD_URL != 'null' }}
123153 run : |
124- NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
125- wget --quiet https://download. nextcloud.com/server/releases/latest-$NCVERSION .zip
126- unzip latest-$NCVERSION .zip
154+ echo "Downloading release tarball from $DOWNLOAD_URL"
155+ wget $DOWNLOAD_URL -O nextcloud.zip
156+ unzip nextcloud .zip
127157
128158 - name : Checkout server master fallback
129- uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5 .2
130- if : ${{ steps.server-checkout .outcome != 'success' }}
159+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0 .2
160+ if : ${{ steps.server-download .outcome != 'success' }}
131161 with :
162+ persist-credentials : false
132163 submodules : true
133164 repository : nextcloud/server
134165 path : nextcloud
135166
167+
136168 - name : Sign app
137169 run : |
138170 # Extracting release
139171 cd ${{ env.APP_NAME }}/build/artifacts
140172 tar -xvf ${{ env.APP_NAME }}.tar.gz
141173 cd ../../../
142174 # Setting up keys
143- echo " ${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
175+ echo ' ${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key # zizmor: ignore[secrets-outside-env]
144176 wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
145177 # Signing
146178 php nextcloud/occ integrity:sign-app --privateKey=../${{ env.APP_NAME }}.key --certificate=../${{ env.APP_NAME }}.crt --path=../${{ env.APP_NAME }}/build/artifacts/${{ env.APP_NAME }}
@@ -149,7 +181,7 @@ jobs:
149181 tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
150182
151183 - name : Attach tarball to github release
152- uses : svenstaro/upload-release-action@2b9d2847a97b04d02ad5c3df2d3a27baa97ce689 # v2
184+ uses : svenstaro/upload-release-action@29e53e917877a24fad85510ded594ab3c9ca12de # v2.11.5
153185 id : attach_to_release
154186 with :
155187 repo_token : ${{ secrets.GITHUB_TOKEN }}
@@ -159,9 +191,9 @@ jobs:
159191 overwrite : true
160192
161193 - name : Upload app to Nextcloud appstore
162- uses : nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1
194+ uses : nextcloud-releases/nextcloud-appstore-push-action@a011fe619bcf6e77ddebc96f9908e1af4071b9c1 # v1.0.3
163195 with :
164196 app_name : ${{ env.APP_NAME }}
165- appstore_token : ${{ secrets.APPSTORE_TOKEN }}
197+ appstore_token : ${{ secrets.APPSTORE_TOKEN }} # zizmor: ignore[secrets-outside-env]
166198 download_url : ${{ steps.attach_to_release.outputs.browser_download_url }}
167- app_private_key : ${{ secrets.APP_PRIVATE_KEY }}
199+ app_private_key : ${{ secrets.APP_PRIVATE_KEY }} # zizmor: ignore[secrets-outside-env]
0 commit comments