Skip to content

Commit 1079c67

Browse files
Create node.yml
Signed-off-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
1 parent 4ae99ca commit 1079c67

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/node.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
name: Node
7+
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- main
13+
- master
14+
- stable*
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
23+
name: node
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v3
27+
28+
- name: Read package.json node and npm engines version
29+
uses: skjnldsv/read-package-engines-version-actions@v1.2
30+
id: versions
31+
with:
32+
fallbackNode: '^12'
33+
fallbackNpm: '^6'
34+
35+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: ${{ steps.versions.outputs.nodeVersion }}
39+
40+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
41+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
42+
43+
- name: Install dependencies & build
44+
run: |
45+
npm ci
46+
npm run build --if-present
47+
48+
- name: Check webpack build changes
49+
run: |
50+
bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
51+
52+
- name: Show changes on failure
53+
if: failure()
54+
run: |
55+
git status
56+
git --no-pager diff
57+
exit 1 # make it red to grab attention
58+

0 commit comments

Comments
 (0)