Skip to content

Commit 02e5a99

Browse files
authored
Merge branch 'nextcloud:main' into master
2 parents c117c57 + c77e900 commit 02e5a99

26 files changed

+7040
-9876
lines changed

.github/workflows/appstore-build-publish.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
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

69
name: Build and publish app release
710

811
on:
912
release:
1013
types: [published]
1114

12-
env:
13-
PHP_VERSION: 8.2
14-
1515
jobs:
1616
build_and_publish:
1717
runs-on: ubuntu-latest
@@ -32,7 +32,7 @@ jobs:
3232
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3333
3434
- name: Checkout
35-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
35+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3636
with:
3737
path: ${{ env.APP_NAME }}
3838

@@ -44,7 +44,7 @@ jobs:
4444
expression: "//info//dependencies//nextcloud/@min-version"
4545

4646
- name: Read package.json node and npm engines version
47-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
47+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
4848
id: versions
4949
# Continue if no package.json
5050
continue-on-error: true
@@ -56,26 +56,32 @@ jobs:
5656
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
5757
# Skip if no package.json
5858
if: ${{ steps.versions.outputs.nodeVersion }}
59-
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v3
59+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
6060
with:
6161
node-version: ${{ steps.versions.outputs.nodeVersion }}
6262

6363
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
6464
# Skip if no package.json
6565
if: ${{ steps.versions.outputs.npmVersion }}
66-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
66+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
67+
68+
- name: Get php version
69+
id: php-versions
70+
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
71+
with:
72+
filename: ${{ env.APP_NAME }}/appinfo/info.xml
6773

68-
- name: Set up php ${{ env.PHP_VERSION }}
69-
uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2
74+
- name: Set up php ${{ steps.php-versions.outputs.php-min }}
75+
uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # v2.31.1
7076
with:
71-
php-version: ${{ env.PHP_VERSION }}
77+
php-version: ${{ steps.php-versions.outputs.php-min }}
7278
coverage: none
7379
env:
7480
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7581

7682
- name: Check composer.json
7783
id: check_composer
78-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
84+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
7985
with:
8086
files: "${{ env.APP_NAME }}/composer.json"
8187

@@ -93,11 +99,11 @@ jobs:
9399
run: |
94100
cd ${{ env.APP_NAME }}
95101
npm ci
96-
npm run build
102+
npm run build --if-present
97103
98104
- name: Check Krankerl config
99105
id: krankerl
100-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
106+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
101107
with:
102108
files: ${{ env.APP_NAME }}/krankerl.toml
103109

@@ -123,12 +129,12 @@ jobs:
123129
continue-on-error: true
124130
id: server-checkout
125131
run: |
126-
NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
132+
NCVERSION='${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
127133
wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
128134
unzip latest-$NCVERSION.zip
129135
130136
- name: Checkout server master fallback
131-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
137+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
132138
if: ${{ steps.server-checkout.outcome != 'success' }}
133139
with:
134140
submodules: true
@@ -142,7 +148,7 @@ jobs:
142148
tar -xvf ${{ env.APP_NAME }}.tar.gz
143149
cd ../../../
144150
# Setting up keys
145-
echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
151+
echo '${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key
146152
wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
147153
# Signing
148154
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 +157,7 @@ jobs:
151157
tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
152158
153159
- name: Attach tarball to github release
154-
uses: svenstaro/upload-release-action@1beeb572c19a9242f4361f4cee78f8e0d9aec5df # v2
160+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
155161
id: attach_to_release
156162
with:
157163
repo_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/command-compile.yml

Lines changed: 55 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# This workflow is provided via the organization template repository
2+
#
3+
# https://github.com/nextcloud/.github
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
8+
19
name: Compile Command
210
on:
311
issue_comment:
@@ -18,6 +26,28 @@ jobs:
1826
base_ref: ${{ steps.comment-branch.outputs.base_ref }}
1927

2028
steps:
29+
- name: Get repository from pull request comment
30+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
31+
id: get-repository
32+
with:
33+
github-token: ${{secrets.GITHUB_TOKEN}}
34+
script: |
35+
const pull = await github.rest.pulls.get({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
pull_number: context.issue.number
39+
});
40+
41+
const repositoryName = pull.data.head?.repo?.full_name
42+
console.log(repositoryName)
43+
return repositoryName
44+
45+
- name: Disabled on forks
46+
if: ${{ fromJSON(steps.get-repository.outputs.result) != github.repository }}
47+
run: |
48+
echo 'Can not execute /compile on forks'
49+
exit 1
50+
2151
- name: Check actor permission
2252
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
2353
with:
@@ -29,7 +59,7 @@ jobs:
2959
token: ${{ secrets.COMMAND_BOT_PAT }}
3060
repository: ${{ github.event.repository.full_name }}
3161
comment-id: ${{ github.event.comment.id }}
32-
reactions: "+1"
62+
reactions: '+1'
3363

3464
- name: Parse command
3565
uses: skjnldsv/parse-command-comment@5c955203c52424151e6d0e58fb9de8a9f6a605a1 # v2
@@ -49,6 +79,15 @@ jobs:
4979
uses: xt0rted/pull-request-comment-branch@d97294d304604fa98a2600a6e2f916a84b596dc7 # v1
5080
id: comment-branch
5181

82+
- name: Add reaction on failure
83+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
84+
if: failure()
85+
with:
86+
token: ${{ secrets.COMMAND_BOT_PAT }}
87+
repository: ${{ github.event.repository.full_name }}
88+
comment-id: ${{ github.event.comment.id }}
89+
reactions: '-1'
90+
5291
process:
5392
runs-on: ubuntu-latest
5493
needs: init
@@ -61,38 +100,38 @@ jobs:
61100
key: git-repo
62101

63102
- name: Checkout ${{ needs.init.outputs.head_ref }}
64-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
103+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
65104
with:
66105
token: ${{ secrets.COMMAND_BOT_PAT }}
67106
fetch-depth: 0
68107
ref: ${{ needs.init.outputs.head_ref }}
69108

70109
- name: Setup git
71110
run: |
72-
git config --local user.email "nextcloud-command@users.noreply.github.com"
73-
git config --local user.name "nextcloud-command"
111+
git config --local user.email 'nextcloud-command@users.noreply.github.com'
112+
git config --local user.name 'nextcloud-command'
74113
75114
- name: Read package.json node and npm engines version
76-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
115+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
77116
id: package-engines-versions
78117
with:
79118
fallbackNode: '^20'
80119
fallbackNpm: '^10'
81120

82121
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
83-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
122+
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
84123
with:
85124
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
86125
cache: npm
87126

88127
- name: Set up npm ${{ steps.package-engines-versions.outputs.npmVersion }}
89-
run: npm i -g npm@"${{ steps.package-engines-versions.outputs.npmVersion }}"
128+
run: npm i -g 'npm@${{ steps.package-engines-versions.outputs.npmVersion }}'
90129

91130
- name: Rebase to ${{ needs.init.outputs.base_ref }}
92131
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
93132
run: |
94-
git fetch origin ${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}
95-
git rebase origin/${{ needs.init.outputs.base_ref }}
133+
git fetch origin '${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}'
134+
git rebase 'origin/${{ needs.init.outputs.base_ref }}'
96135
97136
- name: Install dependencies & build
98137
env:
@@ -105,30 +144,30 @@ jobs:
105144
- name: Commit default
106145
if: ${{ !contains(needs.init.outputs.arg1, 'fixup') && !contains(needs.init.outputs.arg1, 'amend') }}
107146
run: |
108-
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
147+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
109148
git commit --signoff -m 'chore(assets): Recompile assets'
110149
111150
- name: Commit fixup
112151
if: ${{ contains(needs.init.outputs.arg1, 'fixup') }}
113152
run: |
114-
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
153+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
115154
git commit --fixup=HEAD --signoff
116155
117156
- name: Commit amend
118157
if: ${{ contains(needs.init.outputs.arg1, 'amend') }}
119158
run: |
120-
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
159+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
121160
git commit --amend --no-edit --signoff
122161
# Remove any [skip ci] from the amended commit
123162
git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
124-
163+
125164
- name: Push normally
126165
if: ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
127-
run: git push origin ${{ needs.init.outputs.head_ref }}
166+
run: git push origin '${{ needs.init.outputs.head_ref }}'
128167

129168
- name: Force push
130169
if: ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
131-
run: git push --force origin ${{ needs.init.outputs.head_ref }}
170+
run: git push --force origin '${{ needs.init.outputs.head_ref }}'
132171

133172
- name: Add reaction on failure
134173
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
@@ -137,4 +176,4 @@ jobs:
137176
token: ${{ secrets.COMMAND_BOT_PAT }}
138177
repository: ${{ github.event.repository.full_name }}
139178
comment-id: ${{ github.event.comment.id }}
140-
reactions: "-1"
179+
reactions: '-1'

0 commit comments

Comments
 (0)