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
15+ permissions :
16+ contents : write
17+
1218jobs :
1319 build_and_publish :
1420 runs-on : ubuntu-latest
@@ -29,19 +35,31 @@ jobs:
2935 echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3036
3137 - name : Checkout
32- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
38+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3339 with :
40+ persist-credentials : false
3441 path : ${{ env.APP_NAME }}
3542
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+
3654 - name : Get appinfo data
3755 id : appinfo
38- uses : skjnldsv/xpath-action@7e6a7c379d0e9abc8acaef43df403ab4fc4f770c # master
56+ uses : skjnldsv/xpath-action@f5b036e9d973f42c86324833fd00be90665fbf77 # master
3957 with :
4058 filename : ${{ env.APP_NAME }}/appinfo/info.xml
4159 expression : " //info//dependencies//nextcloud/@min-version"
4260
4361 - name : Read package.json node and npm engines version
44- uses : skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
62+ uses : skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
4563 id : versions
4664 # Continue if no package.json
4765 continue-on-error : true
@@ -53,14 +71,14 @@ jobs:
5371 - name : Set up node ${{ steps.versions.outputs.nodeVersion }}
5472 # Skip if no package.json
5573 if : ${{ steps.versions.outputs.nodeVersion }}
56- uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
74+ uses : actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
5775 with :
5876 node-version : ${{ steps.versions.outputs.nodeVersion }}
5977
6078 - name : Set up npm ${{ steps.versions.outputs.npmVersion }}
6179 # Skip if no package.json
6280 if : ${{ steps.versions.outputs.npmVersion }}
63- run : npm i -g npm@" ${{ steps.versions.outputs.npmVersion }}"
81+ run : npm i -g ' npm@${{ steps.versions.outputs.npmVersion }}'
6482
6583 - name : Get php version
6684 id : php-versions
6987 filename : ${{ env.APP_NAME }}/appinfo/info.xml
7088
7189 - name : Set up php ${{ steps.php-versions.outputs.php-min }}
72- uses : shivammathur/setup-php@a4e22b60bbb9c1021113f2860347b0759f66fe5d # v2
90+ uses : shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
7391 with :
7492 php-version : ${{ steps.php-versions.outputs.php-min }}
7593 coverage : none
7896
7997 - name : Check composer.json
8098 id : check_composer
81- uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
99+ uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
82100 with :
83101 files : " ${{ env.APP_NAME }}/composer.json"
84102
@@ -96,11 +114,11 @@ jobs:
96114 run : |
97115 cd ${{ env.APP_NAME }}
98116 npm ci
99- npm run build
117+ npm run build --if-present
100118
101119 - name : Check Krankerl config
102120 id : krankerl
103- uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
121+ uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
104122 with :
105123 files : ${{ env.APP_NAME }}/krankerl.toml
106124
@@ -126,14 +144,15 @@ jobs:
126144 continue-on-error : true
127145 id : server-checkout
128146 run : |
129- NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
147+ NCVERSION=' ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
130148 wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
131149 unzip latest-$NCVERSION.zip
132150
133151 - name : Checkout server master fallback
134- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
152+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
135153 if : ${{ steps.server-checkout.outcome != 'success' }}
136154 with :
155+ persist-credentials : false
137156 submodules : true
138157 repository : nextcloud/server
139158 path : nextcloud
@@ -145,7 +164,7 @@ jobs:
145164 tar -xvf ${{ env.APP_NAME }}.tar.gz
146165 cd ../../../
147166 # Setting up keys
148- echo " ${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
167+ echo ' ${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key
149168 wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
150169 # Signing
151170 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 }}
0 commit comments