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.1
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@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
38+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.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 # master
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 # master
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@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.2
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 : ' ^20 '
69+ fallbackNpm : ' ^10 '
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@8c91899e586c5b171469028077307d293428b516 # v3
74+ uses : actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.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@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
83+ - name : Get php version
84+ id : php-versions
85+ uses : icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
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@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.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
@@ -121,14 +144,15 @@ jobs:
121144 continue-on-error : true
122145 id : server-checkout
123146 run : |
124- NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
147+ NCVERSION=' ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
125148 wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
126149 unzip latest-$NCVERSION.zip
127150
128151 - name : Checkout server master fallback
129- uses : actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
152+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
130153 if : ${{ steps.server-checkout.outcome != 'success' }}
131154 with :
155+ persist-credentials : false
132156 submodules : true
133157 repository : nextcloud/server
134158 path : nextcloud
@@ -140,7 +164,7 @@ jobs:
140164 tar -xvf ${{ env.APP_NAME }}.tar.gz
141165 cd ../../../
142166 # Setting up keys
143- echo " ${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
167+ echo ' ${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key
144168 wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
145169 # Signing
146170 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 +173,7 @@ jobs:
149173 tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
150174
151175 - name : Attach tarball to github release
152- uses : svenstaro/upload-release-action@133984371c30d34e38222a64855679a414cb7575 # v2
176+ uses : svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
153177 id : attach_to_release
154178 with :
155179 repo_token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments