publish.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: Publish
  2. on:
  3. release:
  4. types: [created]
  5. jobs:
  6. build:
  7. runs-on: ubuntu-latest
  8. services:
  9. rabbitmq:
  10. image: rabbitmq:3-alpine
  11. ports:
  12. - 5672:5672
  13. strategy:
  14. matrix:
  15. node-version: [10.x, 12.x, 14.x, 16.x, 18.x, 20.x]
  16. # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
  17. steps:
  18. - uses: actions/checkout@v3
  19. - name: Use Node.js ${{ matrix.node-version }}
  20. uses: actions/setup-node@v3
  21. with:
  22. node-version: ${{ matrix.node-version }}
  23. cache: "npm"
  24. - run: npm ci
  25. - run: |
  26. n=0
  27. while :
  28. do
  29. sleep 5
  30. echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
  31. [[ $? = 0 ]] && break || ((n++))
  32. (( n >= 5 )) && break
  33. done
  34. - run: echo 'HELO\n\n\n\n' | nc localhost 5672 | grep AMQP
  35. - run: make test
  36. publish:
  37. needs: build
  38. runs-on: ubuntu-latest
  39. steps:
  40. - uses: actions/checkout@v3
  41. - uses: actions/setup-node@v3
  42. with:
  43. node-version: '20.x'
  44. cache: "npm"
  45. registry-url: https://registry.npmjs.org/
  46. - run: npm ci
  47. - run: npm publish --dry-run
  48. env:
  49. NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}