publish_docs.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. name: Publish Docs to NPM
  2. on:
  3. push:
  4. branches:
  5. - master
  6. paths:
  7. - 'docs/**'
  8. workflow_dispatch:
  9. inputs:
  10. branch:
  11. description: 'Branch to publish from'
  12. required: true
  13. default: 'master'
  14. type: string
  15. jobs:
  16. publish:
  17. runs-on: ubuntu-latest
  18. permissions:
  19. contents: read
  20. id-token: write
  21. defaults:
  22. run:
  23. working-directory: docs
  24. outputs:
  25. version: ${{ steps.get-version.outputs.version }}
  26. steps:
  27. - name: Checkout
  28. uses: actions/checkout@v4
  29. with:
  30. ref: ${{ inputs.branch || github.ref }}
  31. - name: Setup Node.js
  32. uses: actions/setup-node@v6
  33. with:
  34. node-version: '24.x'
  35. registry-url: 'https://registry.npmjs.org'
  36. - name: Update npm
  37. run: npm install -g npm@latest
  38. - name: Install dependencies
  39. run: npm install
  40. - name: Generate version
  41. id: get-version
  42. run: |
  43. VERSION="0.0.0-$(date +%Y%m%d%H%M)"
  44. echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
  45. echo "Publishing version: ${VERSION}"
  46. - name: Publish to NPM
  47. run: |
  48. npm version ${{ steps.get-version.outputs.version }} --no-git-tag-version
  49. npm publish --tag latest
  50. trigger-vendure-io-update:
  51. needs: publish
  52. runs-on: ubuntu-latest
  53. steps:
  54. - name: Generate token for vendure-io repo
  55. uses: actions/create-github-app-token@v2
  56. id: vendure-io-token
  57. with:
  58. app-id: ${{ secrets.CI_BOT_APP_ID }}
  59. private-key: ${{ secrets.CI_BOT_APP_PRIVATE_KEY }}
  60. owner: vendurehq
  61. repositories: vendure-io
  62. - name: Trigger docs update in vendure-io
  63. uses: peter-evans/repository-dispatch@v3
  64. with:
  65. token: ${{ steps.vendure-io-token.outputs.token }}
  66. repository: vendurehq/vendure-io
  67. event-type: docs-package-update
  68. client-payload: >-
  69. {
  70. "repository": "vendure-ecommerce/vendure",
  71. "package": "@vendure/docs@${{ needs.publish.outputs.version }}",
  72. "sha": "${{ github.sha }}"
  73. }