Fixes isomorphism on SDK #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: NPM Package | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: [18, 20] | |
name: Node ${{ matrix.node }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
cache: "npm" | |
node-version: ${{ matrix.node }} | |
- name: Install dependencies | |
run: npm install | |
# Build before running tests, so tests can be run against the built code for ESM and CJS | |
- name: Build package | |
run: npm run build --workspace=@fileforge/client | |
- name: Run tests | |
run: npm test | |
env: | |
FILEFORGE_API_KEY: ${{ secrets.FILEFORGE_API_KEY }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
registry-url: "https://registry.npmjs.org" | |
cache: "npm" | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build package | |
run: npm run build --workspace=@fileforge/client | |
- name: Publish package | |
run: npm publish --access public | |
working-directory: packages/typescript | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |