|
6 | 6 | # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors |
7 | 7 | # SPDX-License-Identifier: MIT |
8 | 8 |
|
9 | | -name: Node |
| 9 | +# TODO: Remove this after a grace period of 6 months to give everyone the chance to switch to the new workflow name |
| 10 | +# TODO: To be removed end of 2026. |
| 11 | +name: No-op please switch to npm-build.yml |
10 | 12 |
|
11 | 13 | on: pull_request |
12 | 14 |
|
13 | 15 | permissions: |
14 | | - contents: read |
| 16 | + contents: none |
15 | 17 |
|
16 | 18 | concurrency: |
17 | 19 | group: node-${{ github.head_ref || github.run_id }} |
18 | 20 | cancel-in-progress: true |
19 | 21 |
|
20 | 22 | 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@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 |
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.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: '^24' |
65 | | - fallbackNpm: '^11.3' |
66 | | - |
67 | | - - name: Set up node ${{ steps.versions.outputs.nodeVersion }} |
68 | | - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.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: Validate package-lock.json # See https://github.com/npm/cli/issues/4460 |
76 | | - run: | |
77 | | - npm i -g npm-package-lock-add-resolved@1.1.4 |
78 | | - npm-package-lock-add-resolved |
79 | | - git --no-pager diff --exit-code |
80 | | -
|
81 | | - - name: Install dependencies & build |
82 | | - env: |
83 | | - CYPRESS_INSTALL_BINARY: 0 |
84 | | - PUPPETEER_SKIP_DOWNLOAD: true |
85 | | - run: | |
86 | | - npm ci |
87 | | - npm run build --if-present |
88 | | -
|
89 | | - - name: Check build changes |
90 | | - run: | |
91 | | - bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)" |
92 | | -
|
93 | | - - name: Show changes on failure |
94 | | - if: failure() |
95 | | - run: | |
96 | | - git status |
97 | | - git --no-pager diff |
98 | | - exit 1 # make it red to grab attention |
99 | | -
|
100 | 23 | summary: |
101 | | - permissions: |
102 | | - contents: none |
103 | 24 | runs-on: ubuntu-latest-low |
104 | | - needs: [changes, build] |
105 | | - |
106 | 25 | if: always() |
107 | 26 |
|
108 | 27 | # This is the summary, we just avoid to rename it so that branch protection rules still match |
109 | 28 | name: node |
110 | 29 |
|
111 | 30 | steps: |
112 | | - - name: Summary status |
113 | | - run: if ${{ needs.changes.outputs.src != 'false' && needs.build.result != 'success' }}; then exit 1; fi |
| 31 | + - name: No-op please switch to npm-build.yml |
| 32 | + run: echo "The workflow has been renamed, please switch to npm-build.yml from organization templates"; exit 1; |
0 commit comments