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 :
@@ -32,19 +35,31 @@ jobs:
3235 echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3336
3437 - name : Checkout
35- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.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
@@ -56,26 +71,32 @@ jobs:
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@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # 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 }}'
82+
83+ - name : Get php version
84+ id : php-versions
85+ uses : icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
86+ with :
87+ filename : ${{ env.APP_NAME }}/appinfo/info.xml
6788
68- - name : Set up php ${{ env.PHP_VERSION }}
69- uses : shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2
89+ - name : Set up php ${{ steps.php-versions.outputs.php-min }}
90+ uses : shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
7091 with :
71- php-version : ${{ env.PHP_VERSION }}
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@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
99+ uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
79100 with :
80101 files : " ${{ env.APP_NAME }}/composer.json"
81102
@@ -93,11 +114,11 @@ jobs:
93114 run : |
94115 cd ${{ env.APP_NAME }}
95116 npm ci
96- npm run build
117+ npm run build --if-present
97118
98119 - name : Check Krankerl config
99120 id : krankerl
100- uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
121+ uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
101122 with :
102123 files : ${{ env.APP_NAME }}/krankerl.toml
103124
@@ -123,14 +144,15 @@ jobs:
123144 continue-on-error : true
124145 id : server-checkout
125146 run : |
126- NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
147+ NCVERSION=' ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
127148 wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
128149 unzip latest-$NCVERSION.zip
129150
130151 - name : Checkout server master fallback
131- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
152+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
132153 if : ${{ steps.server-checkout.outcome != 'success' }}
133154 with :
155+ persist-credentials : false
134156 submodules : true
135157 repository : nextcloud/server
136158 path : nextcloud
@@ -142,7 +164,7 @@ jobs:
142164 tar -xvf ${{ env.APP_NAME }}.tar.gz
143165 cd ../../../
144166 # Setting up keys
145- echo " ${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
167+ echo ' ${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key
146168 wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
147169 # Signing
148170 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 }}
@@ -151,7 +173,7 @@ jobs:
151173 tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
152174
153175 - name : Attach tarball to github release
154- uses : svenstaro/upload-release-action@1beeb572c19a9242f4361f4cee78f8e0d9aec5df # v2
176+ uses : svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
155177 id : attach_to_release
156178 with :
157179 repo_token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments