2021-06-25 10:39:34 +00:00
|
|
|
# This workflow is provided via the organization template repository
|
|
|
|
#
|
|
|
|
# https://github.com/nextcloud/.github
|
|
|
|
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
|
|
|
|
|
2020-02-28 10:26:27 +00:00
|
|
|
name: Node
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
push:
|
|
|
|
branches:
|
2021-12-17 14:57:58 +00:00
|
|
|
- main
|
2022-03-05 09:57:54 +00:00
|
|
|
- master
|
2020-02-28 10:26:27 +00:00
|
|
|
- stable*
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2021-06-14 05:28:17 +00:00
|
|
|
name: node
|
2020-02-28 10:26:27 +00:00
|
|
|
steps:
|
2021-06-25 10:39:34 +00:00
|
|
|
- name: Checkout
|
2022-03-05 09:57:54 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-06-25 10:39:34 +00:00
|
|
|
|
|
|
|
- name: Read package.json node and npm engines version
|
2022-03-05 09:57:54 +00:00
|
|
|
uses: skjnldsv/read-package-engines-version-actions@v1.2
|
2021-07-24 07:34:23 +00:00
|
|
|
id: versions
|
2021-06-25 10:39:34 +00:00
|
|
|
with:
|
|
|
|
fallbackNode: '^12'
|
|
|
|
fallbackNpm: '^6'
|
2020-02-28 10:26:27 +00:00
|
|
|
|
2021-07-24 07:34:23 +00:00
|
|
|
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
|
2022-03-05 09:57:54 +00:00
|
|
|
uses: actions/setup-node@v3
|
2020-02-28 10:26:27 +00:00
|
|
|
with:
|
2021-07-24 07:34:23 +00:00
|
|
|
node-version: ${{ steps.versions.outputs.nodeVersion }}
|
2021-06-14 05:28:17 +00:00
|
|
|
|
2021-07-24 07:34:23 +00:00
|
|
|
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
|
|
|
|
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
|
2020-02-28 10:26:27 +00:00
|
|
|
|
|
|
|
- name: Install dependencies & build
|
|
|
|
run: |
|
|
|
|
npm ci
|
|
|
|
npm run build --if-present
|
|
|
|
|
|
|
|
- name: Check webpack build changes
|
|
|
|
run: |
|
2021-07-24 07:34:23 +00:00
|
|
|
bash -c "[[ ! \"`git status --porcelain `\" ]] || exit 1"
|
|
|
|
|
|
|
|
- name: Show changes on failure
|
|
|
|
if: failure()
|
|
|
|
run: |
|
|
|
|
git status
|
|
|
|
git --no-pager diff
|