pieces-app / pieces-os-client-sdk-for-typescript

Use Local Language models with your own private and secure Copilot with 50+ powerful endpoints to enhance your next opensource idea to help fuel the community. Open Source by Pieces
https://pieces.app
MIT License
34 stars 14 forks source link

Create Github actions for building / testing the SDK before publishing to NPM #13

Open shivay-at-pieces opened 11 months ago

shivay-at-pieces commented 11 months ago

There is a need to automate the build process for the TypeScript SDK using GitHub Actions and publish to NPM

jwafu commented 10 months ago

@shivay-at-pieces when do we want this action to fire? On each push to main? We may need a specific staging branch to use, that way from staging --> main we then update the version number based on...? Just want to add some more thoughts and planning here before we start implementing this issue! 👍

@nathan-courtney-pieces is there any specific guidance needed here or any repos that we can be pointed to for an example? Would be awesome if you have any time to share a little example of this GH action code or provide any insights that would be great

shivay-at-pieces commented 10 months ago

For publishing to NPM we can fire this action it once we push to main.

Version number could be based on the package.json / or the latest tag

      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 16
          registry-url: https://registry.npmjs.org/
          cache: 'yarn'
      - name: check release version
      run: 
      - name: Install dependencies
        run: yarn install
      - name: Build typescript-sdk
        run: yarn build
      - name: Publish with latest tag
        if: '!github.event.release.prerelease'
        run: npm publish .
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
      - name: Publish with beta tag
        if: 'github.event.release.prerelease'
        run: npm publish . --tag beta
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
jwafu commented 10 months ago

@shivay-at-pieces i think we go ahead and read the package.json, since that version parameter is going to be adjusted on the package.json when its updated, and will be an early exit. Should be fine! last thing will just be testing this on npm.

i suppose using the the event should work, and we can just tag each push to main as either release or prerelease and then push out the beta build. should be awesome and will support the prep for testing during development cycles!

jwafu commented 9 months ago

@shivay-at-pieces just wanted to elevate this issue here ^^ would love to get this in soon