Skip to content

Commit 6e50b03

Browse files
authored
Merge pull request #1467 from nextcloud/ci/update-worfklows
ci: update workflows from templates
2 parents 1c6ffaf + 42b9c28 commit 6e50b03

14 files changed

+358
-158
lines changed

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

Lines changed: 28 additions & 20 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.1
14-
1515
jobs:
1616
build_and_publish:
1717
runs-on: ubuntu-latest
@@ -21,7 +21,7 @@ jobs:
2121

2222
steps:
2323
- name: Check actor permission
24-
uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2.1
24+
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
2525
with:
2626
require: write
2727

@@ -32,7 +32,7 @@ jobs:
3232
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3333
3434
- name: Checkout
35-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
35+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3636
with:
3737
path: ${{ env.APP_NAME }}
3838

@@ -44,38 +44,44 @@ 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@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
47+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
4848
id: versions
4949
# Continue if no package.json
5050
continue-on-error: true
5151
with:
5252
path: ${{ env.APP_NAME }}
53-
fallbackNode: "^16"
54-
fallbackNpm: "^7"
53+
fallbackNode: '^20'
54+
fallbackNpm: '^10'
5555

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@1a4442cacd436585916779262731d5b162bc6ec7 # v3
59+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
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@7fdd3ece872ec7ec4c098ae5ab7637d5e0a96067 # v2
74+
- name: Set up php ${{ steps.php-versions.outputs.php-min }}
75+
uses: shivammathur/setup-php@fc14643b0a99ee9db10a3c025a33d76544fa3761 # v2
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@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
84+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
7985
with:
8086
files: "${{ env.APP_NAME }}/composer.json"
8187

@@ -88,14 +94,16 @@ jobs:
8894
- name: Build ${{ env.APP_NAME }}
8995
# Skip if no package.json
9096
if: ${{ steps.versions.outputs.nodeVersion }}
97+
env:
98+
NODE_ENV: production
9199
run: |
92100
cd ${{ env.APP_NAME }}
93101
npm ci
94-
npm run build
102+
npm run build --if-present
95103
96104
- name: Check Krankerl config
97105
id: krankerl
98-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
106+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
99107
with:
100108
files: ${{ env.APP_NAME }}/krankerl.toml
101109

@@ -121,12 +129,12 @@ jobs:
121129
continue-on-error: true
122130
id: server-checkout
123131
run: |
124-
NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
132+
NCVERSION='${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
125133
wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
126134
unzip latest-$NCVERSION.zip
127135
128136
- name: Checkout server master fallback
129-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
137+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
130138
if: ${{ steps.server-checkout.outcome != 'success' }}
131139
with:
132140
submodules: true
@@ -140,7 +148,7 @@ jobs:
140148
tar -xvf ${{ env.APP_NAME }}.tar.gz
141149
cd ../../../
142150
# Setting up keys
143-
echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
151+
echo '${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key
144152
wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
145153
# Signing
146154
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 +157,7 @@ jobs:
149157
tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
150158
151159
- name: Attach tarball to github release
152-
uses: svenstaro/upload-release-action@2b9d2847a97b04d02ad5c3df2d3a27baa97ce689 # v2
160+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
153161
id: attach_to_release
154162
with:
155163
repo_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/block-merge-freeze.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
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: 2022-2024 Nextcloud GmbH and Nextcloud contributors
7+
# SPDX-License-Identifier: MIT
58

69
name: Block merges during freezes
710

@@ -27,10 +30,10 @@ jobs:
2730
steps:
2831
- name: Register server reference to fallback to master branch
2932
run: |
30-
server_ref="$(if [ "${{ github.base_ref }}" = "main" ]; then echo -n "master"; else echo -n "${{ github.base_ref }}"; fi)"
33+
server_ref="$(if [ '${{ github.base_ref }}' = 'main' ]; then echo -n 'master'; else echo -n '${{ github.base_ref }}'; fi)"
3134
echo "server_ref=$server_ref" >> $GITHUB_ENV
3235
- name: Download version.php from ${{ env.server_ref }}
33-
run: curl https://raw.githubusercontent.com/nextcloud/server/${{ env.server_ref }}/version.php --output version.php
36+
run: curl 'https://raw.githubusercontent.com/nextcloud/server/${{ env.server_ref }}/version.php' --output version.php
3437

3538
- name: Run check
3639
run: cat version.php | grep 'OC_VersionString' | grep -i -v 'RC'

.github/workflows/command-compile.yml

Lines changed: 24 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:
@@ -29,7 +37,7 @@ jobs:
2937
token: ${{ secrets.COMMAND_BOT_PAT }}
3038
repository: ${{ github.event.repository.full_name }}
3139
comment-id: ${{ github.event.comment.id }}
32-
reactions: "+1"
40+
reactions: '+1'
3341

3442
- name: Parse command
3543
uses: skjnldsv/parse-command-comment@5c955203c52424151e6d0e58fb9de8a9f6a605a1 # v2
@@ -55,44 +63,44 @@ jobs:
5563

5664
steps:
5765
- name: Restore cached git repository
58-
uses: buildjet/cache@c3f061234bf0cd3e2ea5f1479d3cd8f526f0ba71 # v3
66+
uses: buildjet/cache@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
5967
with:
6068
path: .git
6169
key: git-repo
6270

6371
- name: Checkout ${{ needs.init.outputs.head_ref }}
64-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
72+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
6573
with:
6674
token: ${{ secrets.COMMAND_BOT_PAT }}
6775
fetch-depth: 0
6876
ref: ${{ needs.init.outputs.head_ref }}
6977

7078
- name: Setup git
7179
run: |
72-
git config --local user.email "[email protected]"
73-
git config --local user.name "nextcloud-command"
80+
git config --local user.email '[email protected]'
81+
git config --local user.name 'nextcloud-command'
7482
7583
- name: Read package.json node and npm engines version
76-
uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
84+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
7785
id: package-engines-versions
7886
with:
7987
fallbackNode: '^20'
8088
fallbackNpm: '^10'
8189

8290
- name: Set up node ${{ steps.package-engines-versions.outputs.nodeVersion }}
83-
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
91+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
8492
with:
8593
node-version: ${{ steps.package-engines-versions.outputs.nodeVersion }}
8694
cache: npm
8795

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

9199
- name: Rebase to ${{ needs.init.outputs.base_ref }}
92100
if: ${{ contains(needs.init.outputs.arg1, 'rebase') }}
93101
run: |
94-
git fetch origin ${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}
95-
git rebase origin/${{ needs.init.outputs.base_ref }}
102+
git fetch origin '${{ needs.init.outputs.base_ref }}:${{ needs.init.outputs.base_ref }}'
103+
git rebase 'origin/${{ needs.init.outputs.base_ref }}'
96104
97105
- name: Install dependencies & build
98106
env:
@@ -105,30 +113,30 @@ jobs:
105113
- name: Commit default
106114
if: ${{ !contains(needs.init.outputs.arg1, 'fixup') && !contains(needs.init.outputs.arg1, 'amend') }}
107115
run: |
108-
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
116+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
109117
git commit --signoff -m 'chore(assets): Recompile assets'
110118
111119
- name: Commit fixup
112120
if: ${{ contains(needs.init.outputs.arg1, 'fixup') }}
113121
run: |
114-
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
122+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
115123
git commit --fixup=HEAD --signoff
116124
117125
- name: Commit amend
118126
if: ${{ contains(needs.init.outputs.arg1, 'amend') }}
119127
run: |
120-
git add ${{ github.workspace }}${{ needs.init.outputs.git_path }}
128+
git add '${{ github.workspace }}${{ needs.init.outputs.git_path }}'
121129
git commit --amend --no-edit --signoff
122130
# Remove any [skip ci] from the amended commit
123131
git commit --amend -m "$(git log -1 --format='%B' | sed '/\[skip ci\]/d')"
124132
125133
- name: Push normally
126134
if: ${{ !contains(needs.init.outputs.arg1, 'rebase') && !contains(needs.init.outputs.arg1, 'amend') }}
127-
run: git push origin ${{ needs.init.outputs.head_ref }}
135+
run: git push origin '${{ needs.init.outputs.head_ref }}'
128136

129137
- name: Force push
130138
if: ${{ contains(needs.init.outputs.arg1, 'rebase') || contains(needs.init.outputs.arg1, 'amend') }}
131-
run: git push --force origin ${{ needs.init.outputs.head_ref }}
139+
run: git push --force origin '${{ needs.init.outputs.head_ref }}'
132140

133141
- name: Add reaction on failure
134142
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
@@ -137,4 +145,4 @@ jobs:
137145
token: ${{ secrets.COMMAND_BOT_PAT }}
138146
repository: ${{ github.event.repository.full_name }}
139147
comment-id: ${{ github.event.comment.id }}
140-
reactions: "-1"
148+
reactions: '-1'

.github/workflows/fixup.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
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: Block fixup and squash commits
710

@@ -24,10 +27,10 @@ jobs:
2427
pull-requests: write
2528
name: Block fixup and squash commits
2629

27-
runs-on: ubuntu-latest
30+
runs-on: ubuntu-latest-low
2831

2932
steps:
3033
- name: Run check
31-
uses: skjnldsv/block-fixup-merge-action@42d26e1b536ce61e5cf467d65fb76caf4aa85acf # v1
34+
uses: skjnldsv/block-fixup-merge-action@c138ea99e45e186567b64cf065ce90f7158c236a # v2
3235
with:
3336
repo-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)