node.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. name: Node
  6. on:
  7. pull_request:
  8. push:
  9. branches:
  10. - master
  11. - stable*
  12. jobs:
  13. build:
  14. runs-on: ubuntu-latest
  15. name: node
  16. steps:
  17. - name: Checkout
  18. uses: actions/checkout@v2
  19. - name: Read package.json node and npm engines version
  20. uses: skjnldsv/read-package-engines-version-actions@v1.1
  21. id: versions
  22. with:
  23. fallbackNode: '^12'
  24. fallbackNpm: '^6'
  25. - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
  26. uses: actions/setup-node@v2
  27. with:
  28. node-version: ${{ steps.versions.outputs.nodeVersion }}
  29. - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
  30. run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
  31. - name: Install dependencies & build
  32. run: |
  33. npm ci
  34. npm run build --if-present
  35. - name: Check webpack build changes
  36. run: |
  37. bash -c "[[ ! \"`git status --porcelain `\" ]] || exit 1"
  38. - name: Show changes on failure
  39. if: failure()
  40. run: |
  41. git status
  42. git --no-pager diff