Skip to content

Merge pull request #79 from mistralai/release/v0.4.0 #164

Merge pull request #79 from mistralai/release/v0.4.0

Merge pull request #79 from mistralai/release/v0.4.0 #164

name: Build and Publish
on:
push:
branches: ["main"]
# We only deploy on tags and main branch
tags:
# Only run on tags that match the following regex
# This will match tags like 1.0.0, 1.0.1, etc.
- "[0-9]+.[0-9]+.[0-9]+"
# Build on pull requests
pull_request:
jobs:
lint_and_test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20, 22]
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
# Set node version
- name: set node version
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# Install Build stuff
- name: Install Dependencies
run: |
npm install
# Eslint
- name: ESlint check
run: |
npm run lint
# Run tests
- name: Run tests
run: |
npm run test
# Build TypeScript Examples
- name: Build typescript examples
run: |
cd examples/typescript
npm install
npx tsc --build --verbose tsconfig.json
publish:
needs: lint_and_test
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags')
steps:
# Checkout the repository
- name: Checkout
uses: actions/checkout@v4
# Set node version
- name: set node version
uses: actions/setup-node@v4
with:
node-version: 18
# Publish module
- name: Publish
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
npm publish