npm-publish.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
  2. # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
  3. name: gpt-cli release
  4. on:
  5. push:
  6. branches: [main]
  7. jobs:
  8. release:
  9. name: Release
  10. runs-on: ubuntu-latest
  11. timeout-minutes: 10
  12. permissions:
  13. contents: write
  14. steps:
  15. - name: Checkout
  16. uses: actions/checkout@v3
  17. - name: Setup Node.js
  18. uses: actions/setup-node@v3
  19. with:
  20. node-version-file: ".nvmrc"
  21. - name: Setup pnpm
  22. uses: pnpm/action-setup@v2
  23. with:
  24. version: 7
  25. run_install: false
  26. - name: Get pnpm store directory
  27. id: pnpm-cache
  28. shell: bash
  29. run: |
  30. echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
  31. - uses: actions/cache@v3
  32. name: Setup pnpm cache
  33. with:
  34. path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
  35. key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
  36. restore-keys: |
  37. ${{ runner.os }}-pnpm-store-
  38. - name: Install dependencies
  39. run: pnpm install
  40. - name: Build
  41. run: pnpm run build
  42. - name: Release
  43. env:
  44. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  45. NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
  46. run: npx semantic-release