node.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. paths:
  9. - '.github/workflows/**'
  10. - 'src/**'
  11. - 'apps/**/appinfo/info.xml'
  12. - 'package.json'
  13. - 'package-lock.json'
  14. - 'tsconfig.json'
  15. - '**.js'
  16. - '**.ts'
  17. - '**.vue'
  18. push:
  19. branches:
  20. - main
  21. - master
  22. - stable*
  23. permissions:
  24. contents: read
  25. concurrency:
  26. group: node-${{ github.head_ref || github.run_id }}
  27. cancel-in-progress: true
  28. jobs:
  29. build:
  30. runs-on: ubuntu-latest
  31. name: node
  32. steps:
  33. - name: Checkout
  34. uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
  35. - name: Read package.json node and npm engines version
  36. uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
  37. id: versions
  38. with:
  39. fallbackNode: '^12'
  40. fallbackNpm: '^6'
  41. - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
  42. uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
  43. with:
  44. node-version: ${{ steps.versions.outputs.nodeVersion }}
  45. - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
  46. run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
  47. - name: Install dependencies & build
  48. run: |
  49. npm ci
  50. npm run build --if-present
  51. - name: Build css
  52. run: npm run sass
  53. - name: Build icons css
  54. run: npm run sass:icons
  55. - name: Check webpack build changes
  56. run: |
  57. bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
  58. - name: Show changes on failure
  59. if: failure()
  60. run: |
  61. git status
  62. git --no-pager diff
  63. exit 1 # make it red to grab attention