Skip to content

feat: add comprehensive CI/CD pipeline and release automation #1

feat: add comprehensive CI/CD pipeline and release automation

feat: add comprehensive CI/CD pipeline and release automation #1

Workflow file for this run

name: CI/CD
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
jobs:
test:
name: Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./lib
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: './lib/package-lock.json'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Run linting
run: npx biome check .
- name: Build package
run: npm run build
publish:
name: Publish to npm
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/v')
defaults:
run:
working-directory: ./lib
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: './lib/package-lock.json'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Build package
run: npm run build
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release:
name: Create Release
runs-on: ubuntu-latest
needs: publish
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false