1
0

publish-js-client.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. name: Publish JS Client
  2. on:
  3. workflow_dispatch:
  4. inputs:
  5. level:
  6. description: Version level
  7. required: true
  8. default: patch
  9. type: choice
  10. options:
  11. - patch
  12. - minor
  13. - major
  14. - prerelease
  15. - prepatch
  16. - preminor
  17. - premajor
  18. tag:
  19. description: NPM Tag (and preid for pre-releases)
  20. required: true
  21. type: string
  22. default: latest
  23. create_release:
  24. description: Create a GitHub release
  25. required: true
  26. type: boolean
  27. default: true
  28. jobs:
  29. test_js:
  30. name: Test JS client
  31. runs-on: ubuntu-latest
  32. steps:
  33. - name: Git Checkout
  34. uses: actions/checkout@v4
  35. - name: Setup Environment
  36. uses: ./.github/actions/setup
  37. with:
  38. cargo-cache-key: cargo-programs
  39. solana: true
  40. - name: Format JS Client
  41. run: pnpm clients:js:format
  42. - name: Lint JS Client
  43. run: pnpm clients:js:lint
  44. - name: Build Programs
  45. run: pnpm programs:build
  46. - name: Test JS Client
  47. run: pnpm clients:js:test
  48. publish_js:
  49. name: Publish JS client
  50. runs-on: ubuntu-latest
  51. needs: test_js
  52. permissions:
  53. contents: write
  54. steps:
  55. - name: Git Checkout
  56. uses: actions/checkout@v4
  57. with:
  58. token: ${{ secrets.ANZA_TEAM_PAT }}
  59. - name: Setup Environment
  60. uses: ./.github/actions/setup
  61. - name: Ensure NPM_TOKEN variable is set
  62. env:
  63. token: ${{ secrets.NPM_TOKEN }}
  64. if: ${{ env.token == '' }}
  65. run: |
  66. echo "The NPM_TOKEN secret variable is not set"
  67. echo "Go to \"Settings\" -> \"Secrets and variables\" -> \"Actions\" -> \"New repository secret\"."
  68. exit 1
  69. - name: NPM Authentication
  70. run: pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}"
  71. env:
  72. NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
  73. - name: Set Git Author
  74. run: |
  75. git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
  76. git config --global user.name "github-actions[bot]"
  77. - name: Publish JS Client
  78. id: publish
  79. run: pnpm clients:js:publish ${{ inputs.level }} ${{ inputs.tag }}
  80. - name: Push Commit and Tag
  81. run: git push origin --follow-tags
  82. - name: Create GitHub release
  83. if: github.event.inputs.create_release == 'true'
  84. uses: ncipollo/release-action@v1
  85. with:
  86. tag: js@v${{ steps.publish.outputs.new_version }}