Skip to content

Commit 1988d27

Browse files
committed
chore: update workflows from script
Signed-off-by: Edward Ly <[email protected]>
1 parent 58aa939 commit 1988d27

File tree

11 files changed

+383
-153
lines changed

11 files changed

+383
-153
lines changed

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

Lines changed: 39 additions & 17 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:
@@ -32,19 +35,31 @@ jobs:
3235
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
3336
3437
- name: Checkout
35-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
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@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.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
@@ -56,26 +71,32 @@ jobs:
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@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # 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 }}'
82+
83+
- name: Get php version
84+
id: php-versions
85+
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
86+
with:
87+
filename: ${{ env.APP_NAME }}/appinfo/info.xml
6788

68-
- name: Set up php ${{ env.PHP_VERSION }}
69-
uses: shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2
89+
- name: Set up php ${{ steps.php-versions.outputs.php-min }}
90+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
7091
with:
71-
php-version: ${{ env.PHP_VERSION }}
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@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
99+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
79100
with:
80101
files: "${{ env.APP_NAME }}/composer.json"
81102

@@ -93,11 +114,11 @@ jobs:
93114
run: |
94115
cd ${{ env.APP_NAME }}
95116
npm ci
96-
npm run build
117+
npm run build --if-present
97118
98119
- name: Check Krankerl config
99120
id: krankerl
100-
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
121+
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0
101122
with:
102123
files: ${{ env.APP_NAME }}/krankerl.toml
103124

@@ -123,14 +144,15 @@ jobs:
123144
continue-on-error: true
124145
id: server-checkout
125146
run: |
126-
NCVERSION=${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}
147+
NCVERSION='${{ fromJSON(steps.appinfo.outputs.result).nextcloud.min-version }}'
127148
wget --quiet https://download.nextcloud.com/server/releases/latest-$NCVERSION.zip
128149
unzip latest-$NCVERSION.zip
129150
130151
- name: Checkout server master fallback
131-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
152+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
132153
if: ${{ steps.server-checkout.outcome != 'success' }}
133154
with:
155+
persist-credentials: false
134156
submodules: true
135157
repository: nextcloud/server
136158
path: nextcloud
@@ -142,7 +164,7 @@ jobs:
142164
tar -xvf ${{ env.APP_NAME }}.tar.gz
143165
cd ../../../
144166
# Setting up keys
145-
echo "${{ secrets.APP_PRIVATE_KEY }}" > ${{ env.APP_NAME }}.key
167+
echo '${{ secrets.APP_PRIVATE_KEY }}' > ${{ env.APP_NAME }}.key
146168
wget --quiet "https://github.com/nextcloud/app-certificate-requests/raw/master/${{ env.APP_NAME }}/${{ env.APP_NAME }}.crt"
147169
# Signing
148170
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 +173,7 @@ jobs:
151173
tar -zcvf ${{ env.APP_NAME }}.tar.gz ${{ env.APP_NAME }}
152174
153175
- name: Attach tarball to github release
154-
uses: svenstaro/upload-release-action@1beeb572c19a9242f4361f4cee78f8e0d9aec5df # v2
176+
uses: svenstaro/upload-release-action@04733e069f2d7f7f0b4aebc4fbdbce8613b03ccd # v2
155177
id: attach_to_release
156178
with:
157179
repo_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/lint-eslint.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ jobs:
5656

5757
steps:
5858
- name: Checkout
59-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
59+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60+
with:
61+
persist-credentials: false
6062

6163
- name: Read package.json node and npm engines version
6264
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
@@ -66,7 +68,7 @@ jobs:
6668
fallbackNpm: '^10'
6769

6870
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
69-
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v3
71+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
7072
with:
7173
node-version: ${{ steps.versions.outputs.nodeVersion }}
7274

.github/workflows/lint-info-xml.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
name: info.xml lint
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
persist-credentials: false
2830

2931
- name: Download schema
3032
run: wget https://raw.githubusercontent.com/nextcloud/appstore/master/nextcloudappstore/api/v1/release/info.xsd

.github/workflows/lint-php-cs.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,28 @@ jobs:
2525

2626
steps:
2727
- name: Checkout
28-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
persist-credentials: false
2931

3032
- name: Get php version
3133
id: versions
3234
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.3.1
3335

34-
- name: Set up php${{ steps.versions.outputs.php-available }}
35-
uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
36+
- name: Set up php${{ steps.versions.outputs.php-min }}
37+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
3638
with:
37-
php-version: ${{ steps.versions.outputs.php-available }}
39+
php-version: ${{ steps.versions.outputs.php-min }}
3840
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
3941
coverage: none
4042
ini-file: development
4143
env:
4244
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4345

4446
- name: Install dependencies
45-
run: composer i
47+
run: |
48+
composer remove nextcloud/ocp --dev
49+
composer i
4650
4751
- name: Lint
4852
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

.github/workflows/lint-php.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ jobs:
2424
php-versions: ${{ steps.versions.outputs.php-versions }}
2525
steps:
2626
- name: Checkout app
27-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
27+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28+
with:
29+
persist-credentials: false
30+
2831
- name: Get version matrix
2932
id: versions
3033
uses: icewind1991/nextcloud-version-matrix@58becf3b4bb6dc6cef677b15e2fd8e7d48c0908f # v1.0.0
@@ -40,10 +43,12 @@ jobs:
4043

4144
steps:
4245
- name: Checkout
43-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
46+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
with:
48+
persist-credentials: false
4449

4550
- name: Set up php ${{ matrix.php-versions }}
46-
uses: shivammathur/setup-php@2e947f1f6932d141d076ca441d0e1e881775e95b # v2.31.0
51+
uses: shivammathur/setup-php@9e72090525849c5e82e596468b86eb55e9cc5401 # v2.32.0
4752
with:
4853
php-version: ${{ matrix.php-versions }}
4954
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite

.github/workflows/node-build.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/node.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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+
9+
name: Node
10+
11+
on: pull_request
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: node-${{ github.head_ref || github.run_id }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
changes:
22+
runs-on: ubuntu-latest-low
23+
permissions:
24+
contents: read
25+
pull-requests: read
26+
27+
outputs:
28+
src: ${{ steps.changes.outputs.src}}
29+
30+
steps:
31+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
32+
id: changes
33+
continue-on-error: true
34+
with:
35+
filters: |
36+
src:
37+
- '.github/workflows/**'
38+
- 'src/**'
39+
- 'appinfo/info.xml'
40+
- 'package.json'
41+
- 'package-lock.json'
42+
- 'tsconfig.json'
43+
- '**.js'
44+
- '**.ts'
45+
- '**.vue'
46+
47+
build:
48+
runs-on: ubuntu-latest
49+
50+
needs: changes
51+
if: needs.changes.outputs.src != 'false'
52+
53+
name: NPM build
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57+
with:
58+
persist-credentials: false
59+
60+
- name: Read package.json node and npm engines version
61+
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
62+
id: versions
63+
with:
64+
fallbackNode: '^20'
65+
fallbackNpm: '^10'
66+
67+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
68+
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
69+
with:
70+
node-version: ${{ steps.versions.outputs.nodeVersion }}
71+
72+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
73+
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
74+
75+
- name: Install dependencies & build
76+
env:
77+
CYPRESS_INSTALL_BINARY: 0
78+
PUPPETEER_SKIP_DOWNLOAD: true
79+
run: |
80+
npm ci
81+
npm run build --if-present
82+
83+
- name: Check webpack build changes
84+
run: |
85+
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
86+
87+
- name: Show changes on failure
88+
if: failure()
89+
run: |
90+
git status
91+
git --no-pager diff
92+
exit 1 # make it red to grab attention
93+
94+
summary:
95+
permissions:
96+
contents: none
97+
runs-on: ubuntu-latest-low
98+
needs: [changes, build]
99+
100+
if: always()
101+
102+
# This is the summary, we just avoid to rename it so that branch protection rules still match
103+
name: node
104+
105+
steps:
106+
- name: Summary status
107+
run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi

0 commit comments

Comments
 (0)