publish_and_install_pr.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. name: Publish & Install PR
  2. on:
  3. pull_request:
  4. branches:
  5. - master
  6. - major
  7. - minor
  8. paths:
  9. - 'packages/**'
  10. - 'package.json'
  11. - 'package-lock.json'
  12. concurrency:
  13. group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  14. cancel-in-progress: true
  15. defaults:
  16. run:
  17. shell: bash
  18. jobs:
  19. publish_install:
  20. runs-on: ${{ matrix.os }}
  21. strategy:
  22. matrix:
  23. os: [ubuntu-latest, windows-latest, macos-latest]
  24. node-version: [20.x, 22.x]
  25. fail-fast: false
  26. steps:
  27. - uses: actions/checkout@v4
  28. - name: Use Node.js ${{ matrix.node-version }}
  29. uses: actions/setup-node@v4
  30. with:
  31. node-version: ${{ matrix.node-version }}
  32. - name: Install Verdaccio
  33. run: |
  34. npm install -g verdaccio
  35. npm install -g wait-on
  36. tmp_registry_log=`mktemp`
  37. mkdir -p $HOME/.config/verdaccio
  38. cp -v ./.github/workflows/verdaccio/config.yaml $HOME/.config/verdaccio/config.yaml
  39. nohup verdaccio --config $HOME/.config/verdaccio/config.yaml &
  40. wait-on http://localhost:4873
  41. TOKEN_RES=$(curl -XPUT \
  42. -H "Content-type: application/json" \
  43. -d '{ "name": "test", "password": "test" }' \
  44. 'http://localhost:4873/-/user/org.couchdb.user:test')
  45. TOKEN=$(echo "$TOKEN_RES" | jq -r '.token')
  46. npm set //localhost:4873/:_authToken $TOKEN
  47. - name: Windows dependencies
  48. if: matrix.os == 'windows-latest'
  49. run: npm install -g @angular/cli
  50. - name: npm install
  51. run: |
  52. npm install
  53. env:
  54. CI: true
  55. - name: Publish to Verdaccio
  56. run: |
  57. nohup verdaccio --config $HOME/.config/verdaccio/config.yaml &
  58. wait-on http://localhost:4873
  59. npx lerna publish prepatch --preid ci --no-push --no-git-tag-version --no-commit-hooks --force-publish "*" --yes --dist-tag ci --registry http://localhost:4873
  60. - name: Install via @vendure/create
  61. run: |
  62. mkdir -p $HOME/install
  63. cd $HOME/install
  64. nohup verdaccio --config $HOME/.config/verdaccio/config.yaml &
  65. wait-on http://localhost:4873
  66. npm set registry=http://localhost:4873
  67. npm dist-tag ls @vendure/create
  68. npx @vendure/create@ci test-app --ci --use-npm --log-level info
  69. - name: Server smoke tests
  70. run: |
  71. cd $HOME/install/test-app
  72. npm run dev &
  73. node $GITHUB_WORKSPACE/.github/workflows/scripts/smoke-tests