Modularize SDK client #219
Workflow file for this run
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: CI Workflows | |
on: | |
push: | |
branches: ["main"] | |
tags: | |
- "v*" | |
pull_request: | |
jobs: | |
lint-and-test: | |
strategy: | |
matrix: | |
version: [18, 19, 20, 21] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
id: setup-node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.version }} | |
cache: yarn | |
- name: Install JavaScript Dependencies | |
run: | | |
yarn install --frozen-lockfile --ignore-engines | |
- name: Lint | |
if: success() || failure() | |
run: | | |
yarn lint | |
- name: Type Check | |
if: success() || failure() | |
run: | | |
yarn type-check | |
- name: Build | |
if: success() || failure() | |
run: | | |
yarn build | |
# We only run the browser tests for the development version of node because the browser environment | |
# is independent of the node version, so all that matters is the build we deploy works in the browser. | |
- name: Conditionally Install Chrome Dependencies | |
if: (success() || failure()) && matrix.version == 18 | |
run: | | |
sudo apt-get install -y libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libgbm1 libasound2 libpangocairo-1.0-0 libxss1 libgtk-3-0 | |
- name: Conditionally Remove Browser Tests | |
if: (success() || failure()) && matrix.version != 18 | |
run: | | |
rm test/browser.test.ts | |
- name: Test | |
if: success() || failure() | |
run: | | |
yarn test:fast | |
deploy: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
needs: [lint-and-test] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.19.0 | |
registry-url: "https://registry.npmjs.org" | |
- name: Extract Version from Tag | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Install JavaScript Dependencies | |
run: yarn install --frozen-lockfile | |
- name: Update package.json Version | |
run: npm version --no-git-tag-version $VERSION | |
- name: Build With Updated Version | |
if: success() || failure() | |
run: | | |
yarn build | |
- name: Publish to NPM | |
run: | | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |