node.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: Build css
  39. run: npm run sass
  40. - name: Build icons css
  41. run: npm run sass:icons
  42. - name: Check webpack build changes
  43. run: |
  44. bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
  45. - name: Show changes on failure
  46. if: failure()
  47. run: |
  48. git status
  49. git --no-pager diff
  50. exit 1 # make it red to grab attention