-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (95 loc) · 2.99 KB
/
node.yml
File metadata and controls
118 lines (95 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# SPDX-FileCopyrightText: 2026 LibreCode Coop and LibreCode contributors
#
# SPDX-License-Identifier: AGPL-3.0-or-later
# Inspired by LibreSign / Nextcloud app workflows
name: Node
on:
pull_request:
push:
branches:
- main
- master
- stable*
permissions:
contents: read
concurrency:
group: node-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
src: ${{ steps.changes.outputs.src }}
steps:
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/**'
- 'src/**'
- 'appinfo/info.xml'
- 'package.json'
- 'package-lock.json'
- 'tsconfig.json'
- 'vite.config.js'
- 'vitest.config.js'
- '**.js'
- '**.ts'
- '**.vue'
build-and-test:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
name: NPM build
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Read package.json node and npm engines version
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3
id: versions
with:
fallbackNode: '^24'
fallbackNpm: '^11.3'
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}'
- name: Validate package-lock.json
run: |
npm i -g npm-package-lock-add-resolved@1.1.4
npm-package-lock-add-resolved
git --no-pager diff --exit-code
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build --if-present
- name: Test
run: npm run test --if-present
- name: Check generated asset changes
run: |
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please rebuild and commit generated frontend assets. See diff below.' && exit 1)"
- name: Show changes on failure
if: failure()
run: |
git status
git --no-pager diff
exit 1
summary:
permissions:
contents: none
runs-on: ubuntu-latest
needs: [changes, build-and-test]
if: always()
name: node
steps:
- name: Summary status
run: if ${{ needs.changes.outputs.src != 'false' && needs.build-and-test.result != 'success' }}; then exit 1; fi