main.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 (release)
  60. if: github.event_name == 'release'
  61. run: npm publish
  62. env:
  63. NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
  64. - name: Deploy (release candidate)
  65. if: github.event_name == 'push'
  66. run: |
  67. npm --no-git-tag-version version prerelease
  68. npm publish --tag next
  69. env:
  70. NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
  71. deploy_npm:
  72. name: Deploy to NPM
  73. needs: [linting, tests, minification]
  74. runs-on: ubuntu-latest
  75. steps:
  76. - uses: actions/checkout@v1
  77. - name: Use Node.js 8
  78. uses: actions/setup-node@v1
  79. with:
  80. node-version: 8
  81. registry-url: https://npm.pkg.github.com/
  82. scope: '@select2'
  83. - name: npm install
  84. run: npm install
  85. - name: Run linting, tests, minify
  86. run: grunt
  87. - name: Deploy
  88. if: github.event_name == 'release'
  89. run: npm publish
  90. env:
  91. NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}