2
2
#
3
3
# https://github.com/nextcloud/.github
4
4
# 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
5
8
6
9
name : Build and publish app release
7
10
8
11
on :
9
12
release :
10
13
types : [published]
11
14
15
+ permissions :
16
+ contents : write
17
+
12
18
jobs :
13
19
build_and_publish :
14
20
runs-on : ubuntu-latest
@@ -29,19 +35,31 @@ jobs:
29
35
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
30
36
31
37
- name : Checkout
32
- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
38
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33
39
with :
40
+ persist-credentials : false
34
41
path : ${{ env.APP_NAME }}
35
42
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
+
36
54
- name : Get appinfo data
37
55
id : appinfo
38
- uses : skjnldsv/xpath-action@7e6a7c379d0e9abc8acaef43df403ab4fc4f770c # master
56
+ uses : skjnldsv/xpath-action@f5b036e9d973f42c86324833fd00be90665fbf77 # master
39
57
with :
40
58
filename : ${{ env.APP_NAME }}/appinfo/info.xml
41
59
expression : " //info//dependencies//nextcloud/@min-version"
42
60
43
61
- 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
45
63
id : versions
46
64
# Continue if no package.json
47
65
continue-on-error : true
@@ -53,14 +71,14 @@ jobs:
53
71
- name : Set up node ${{ steps.versions.outputs.nodeVersion }}
54
72
# Skip if no package.json
55
73
if : ${{ steps.versions.outputs.nodeVersion }}
56
- uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
74
+ uses : actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
57
75
with :
58
76
node-version : ${{ steps.versions.outputs.nodeVersion }}
59
77
60
78
- name : Set up npm ${{ steps.versions.outputs.npmVersion }}
61
79
# Skip if no package.json
62
80
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 }}'
64
82
65
83
- name : Get php version
66
84
id : php-versions
69
87
filename : ${{ env.APP_NAME }}/appinfo/info.xml
70
88
71
89
- 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
73
91
with :
74
92
php-version : ${{ steps.php-versions.outputs.php-min }}
75
93
coverage : none
78
96
79
97
- name : Check composer.json
80
98
id : check_composer
81
- uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
99
+ uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
82
100
with :
83
101
files : " ${{ env.APP_NAME }}/composer.json"
84
102
@@ -96,11 +114,11 @@ jobs:
96
114
run : |
97
115
cd ${{ env.APP_NAME }}
98
116
npm ci
99
- npm run build
117
+ npm run build --if-present
100
118
101
119
- name : Check Krankerl config
102
120
id : krankerl
103
- uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
121
+ uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
104
122
with :
105
123
files : ${{ env.APP_NAME }}/krankerl.toml
106
124
@@ -126,14 +144,15 @@ jobs:
126
144
continue-on-error : true
127
145
id : server-checkout
128
146
run : |
129
- NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
147
+ NCVERSION=' ${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
130
148
wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
131
149
unzip latest-$NCVERSION.zip
132
150
133
151
- name : Checkout server master fallback
134
- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
152
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
135
153
if : ${{ steps.server-checkout.outcome != 'success' }}
136
154
with :
155
+ persist-credentials : false
137
156
submodules : true
138
157
repository : nextcloud/server
139
158
path : nextcloud
@@ -145,7 +164,7 @@ jobs:
145
164
tar -xvf ${{ env.APP_NAME }}.tar.gz
146
165
cd ../../../
147
166
# Setting up keys
148
- echo " ${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
167
+ echo ' ${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key
149
168
wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
150
169
# Signing
151
170
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