1
0

node.yml 1.5 KB

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