Skip to content

Commit bc85383

Browse files
authored
Merge pull request #22 from nextcloud/fix/gh-actions
chore: update workflows from script
2 parents 14df941 + 93b8358 commit bc85383

File tree

3 files changed

+66
-33
lines changed

3 files changed

+66
-33
lines changed

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

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
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
15+
permissions:
16+
contents: write
1417

1518
jobs:
1619
build_and_publish:
@@ -21,7 +24,7 @@ jobs:
2124

2225
steps:
2326
- name: Check actor permission
24-
uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2.1
27+
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v3.0
2528
with:
2629
require: write
2730

@@ -32,50 +35,68 @@ jobs:
3235
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3336
3437
- name: Checkout
35-
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
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@1bdcee71fa343c46b18dc6aceffb4cd1e35209c6 # v1.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
5166
with:
5267
path: ${{ env.APP_NAME }}
53-
fallbackNode: "^16"
54-
fallbackNpm: "^7"
68+
fallbackNode: '^20'
69+
fallbackNpm: '^10'
5570

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@8c91899e586c5b171469028077307d293428b516 # 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 }}'
6782

68-
- name: Set up php ${{ env.PHP_VERSION }}
69-
uses: shivammathur/setup-php@1a18b2267f80291a81ca1d33e7c851fe09e7dfc4 # v2
83+
- name: Get php version
84+
id: php-versions
85+
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
7086
with:
71-
php-version: ${{ env.PHP_VERSION }}
87+
filename: ${{ env.APP_NAME }}/appinfo/info.xml
88+
89+
- name: Set up php ${{ steps.php-versions.outputs.php-min }}
90+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
91+
with:
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@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
99+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
79100
with:
80101
files: "${{ env.APP_NAME }}/composer.json"
81102

@@ -88,14 +109,16 @@ jobs:
88109
- name: Build ${{ env.APP_NAME }}
89110
# Skip if no package.json
90111
if: ${{ steps.versions.outputs.nodeVersion }}
112+
env:
113+
CYPRESS_INSTALL_BINARY: 0
91114
run: |
92115
cd ${{ env.APP_NAME }}
93116
npm ci
94-
npm run build
117+
npm run build --if-present
95118
96119
- name: Check Krankerl config
97120
id: krankerl
98-
uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
121+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
99122
with:
100123
files: ${{ env.APP_NAME }}/krankerl.toml
101124

@@ -121,14 +144,15 @@ jobs:
121144
continue-on-error: true
122145
id: server-checkout
123146
run: |
124-
NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
147+
NCVERSION='${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
125148
wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
126149
unzip latest-$NCVERSION.zip
127150
128151
- name: Checkout server master fallback
129-
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
152+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
130153
if: ${{ steps.server-checkout.outcome != 'success' }}
131154
with:
155+
persist-credentials: false
132156
submodules: true
133157
repository: nextcloud/server
134158
path: nextcloud
@@ -140,7 +164,7 @@ jobs:
140164
tar -xvf ${{ env.APP_NAME }}.tar.gz
141165
cd ../../../
142166
# Setting up keys
143-
echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
167+
echo '${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key
144168
wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
145169
# Signing
146170
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 +173,7 @@ jobs:
149173
tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
150174
151175
- name: Attach tarball to github release
152-
uses: svenstaro/upload-release-action@133984371c30d34e38222a64855679a414cb7575 # v2
176+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
153177
id: attach_to_release
154178
with:
155179
repo_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr-feedback.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ on:
1515
schedule:
1616
- cron: '30 1 * * *'
1717

18+
permissions:
19+
contents: read
20+
pull-requests: write
21+
1822
jobs:
1923
pr-feedback:
24+
if: ${{ github.repository_owner == 'nextcloud' }}
2025
runs-on: ubuntu-latest
2126
steps:
2227
- name: The get-github-handles-from-website action
23-
uses: marcelklehr/get-github-handles-from-website-action@a739600f6b91da4957f51db0792697afbb2f143c # v1.0.0
28+
uses: marcelklehr/get-github-handles-from-website-action@06b2239db0a48fe1484ba0bfd966a3ab81a08308 # v1.0.1
2429
id: scrape
2530
with:
2631
website: 'https://nextcloud.com/team/'
@@ -31,7 +36,7 @@ jobs:
3136
blocklist=$(curl https://raw.githubusercontent.com/nextcloud/.github/master/non-community-usernames.txt | paste -s -d, -)
3237
echo "blocklist=$blocklist" >> "$GITHUB_OUTPUT"
3338
34-
- uses: marcelklehr/pr-feedback-action@1883b38a033fb16f576875e0cf45f98b857655c4
39+
- uses: nextcloud/pr-feedback-action@1883b38a033fb16f576875e0cf45f98b857655c4 # main
3540
with:
3641
feedback-message: |
3742
Hello there,

.github/workflows/publish-docker-cpu.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,47 +19,51 @@ jobs:
1919
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
2020
2121
- name: Checkout
22-
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
22+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2323
with:
24+
persist-credentials: false
2425
path: ${{ env.APP_NAME }}
2526

2627
- name: Read package.json node and npm engines version
27-
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
28+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
2829
id: versions
2930
# Continue if no package.json
3031
continue-on-error: true
3132
with:
3233
path: ${{ env.APP_NAME }}
33-
fallbackNode: "^20"
34-
fallbackNpm: "^10"
34+
fallbackNode: '^20'
35+
fallbackNpm: '^10'
3536

3637
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
3738
# Skip if no package.json
3839
if: ${{ steps.versions.outputs.nodeVersion }}
39-
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
40+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
4041
with:
4142
node-version: ${{ steps.versions.outputs.nodeVersion }}
4243

4344
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
4445
# Skip if no package.json
4546
if: ${{ steps.versions.outputs.npmVersion }}
46-
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
47+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
4748

4849
- name: Build ${{ env.APP_NAME }}
4950
# Skip if no package.json
5051
if: ${{ steps.versions.outputs.nodeVersion }}
52+
env:
53+
CYPRESS_INSTALL_BINARY: 0
5154
run: |
5255
cd ${{ env.APP_NAME }}
5356
npm ci
54-
npm run build
57+
npm run build --if-present
5558
5659
- name: Set up QEMU
57-
uses: docker/setup-qemu-action@v3
60+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
61+
5862
- name: Set up Docker Buildx
59-
uses: docker/setup-buildx-action@v3
63+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0 # zizmor: ignore[cache-poisoning]
6064

6165
- name: Log in to GitHub Container Registry
62-
uses: docker/login-action@v3
66+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
6367
with:
6468
registry: ghcr.io
6569
username: ${{ github.actor }}
@@ -83,7 +87,7 @@ jobs:
8387
echo "Extracted version: ${{ env.VERSION }}"
8488
8589
- name: Build container image
86-
uses: docker/build-push-action@v5
90+
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 # zizmor: ignore[cache-poisoning]
8791
with:
8892
push: true
8993
context: ./${{ env.APP_NAME }}

0 commit comments

Comments
 (0)