main.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. name: CI
  2. on: [push, pull_request, release]
  3. jobs:
  4. linting:
  5. name: Linting
  6. runs-on: ubuntu-latest
  7. steps:
  8. - uses: actions/checkout@v1
  9. - name: Use Node.js 8
  10. uses: actions/setup-node@v1
  11. with:
  12. node-version: 8
  13. - name: npm install
  14. run: npm install
  15. - name: Run linting
  16. run: grunt compile lint
  17. tests:
  18. name: Tests
  19. runs-on: ubuntu-latest
  20. steps:
  21. - uses: actions/checkout@v1
  22. - name: Use Node.js 8
  23. uses: actions/setup-node@v1
  24. with:
  25. node-version: 8
  26. - name: npm install
  27. run: npm install
  28. - name: Run tests
  29. run: grunt compile test
  30. minification:
  31. name: Minification
  32. runs-on: ubuntu-latest
  33. steps:
  34. - uses: actions/checkout@v1
  35. - name: Use Node.js 8
  36. uses: actions/setup-node@v1
  37. with:
  38. node-version: 8
  39. - name: npm install
  40. run: npm install
  41. - name: Run minification
  42. run: grunt compile minify
  43. deploy_github:
  44. name: Deploy to GitHub Package Registry
  45. needs: [linting, tests, minification]
  46. runs-on: ubuntu-latest
  47. steps:
  48. - uses: actions/checkout@v1
  49. - name: Use Node.js 8
  50. uses: actions/setup-node@v1
  51. with:
  52. node-version: 8
  53. registry-url: https://npm.pkg.github.com/
  54. scope: '@select2'
  55. - name: npm install
  56. run: npm install
  57. - name: Run linting, tests, minify
  58. run: grunt
  59. - name: Deploy
  60. if: github.event_name == 'push'
  61. run: npm publish
  62. env:
  63. NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
  64. deploy_npm:
  65. name: Deploy to NPM
  66. needs: [linting, tests, minification]
  67. runs-on: ubuntu-latest
  68. steps:
  69. - uses: actions/checkout@v1
  70. - name: Use Node.js 8
  71. uses: actions/setup-node@v1
  72. with:
  73. node-version: 8
  74. registry-url: https://npm.pkg.github.com/
  75. scope: '@select2'
  76. - name: npm install
  77. run: npm install
  78. - name: Run linting, tests, minify
  79. run: grunt
  80. - name: Deploy
  81. if: github.event_name == 'release'
  82. run: npm publish
  83. env:
  84. NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}