You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

node.yml 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. - '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@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.6.0
  35. - name: Read package.json node and npm engines version
  36. uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2
  37. id: versions
  38. with:
  39. fallbackNode: '^20'
  40. fallbackNpm: '^9'
  41. - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
  42. uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # 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. env:
  49. CYPRESS_INSTALL_BINARY: 0
  50. run: |
  51. npm ci
  52. npm run build --if-present
  53. - name: Check webpack build changes
  54. run: |
  55. bash -c "[[ ! \"`git status --porcelain `\" ]] || (echo 'Please recompile and commit the assets, see the section \"Show changes on failure\" for details' && exit 1)"
  56. - name: Show changes on failure
  57. if: failure()
  58. run: |
  59. git status
  60. git --no-pager diff
  61. exit 1 # make it red to grab attention