Security updates, TypeScript improvements, and test coverage #1
Workflow file for this run
This file contains hidden or 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 | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x, 22.x] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Run linting | |
run: npm run lint | |
- name: Run type checking | |
run: npm run typecheck | |
- name: Run tests | |
run: npm run test | |
- name: Run test coverage | |
run: npm run coverage | |
- name: Upload coverage to Codecov | |
if: matrix.node-version == '20.x' | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: false | |
verbose: true | |
- name: Build package | |
run: npm run build:production | |
- name: Build documentation | |
run: npm run build | |
security: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Run security audit | |
run: npm audit --audit-level=moderate | |
- name: Check for outdated dependencies | |
run: npm outdated || true | |
publish: | |
runs-on: ubuntu-latest | |
needs: [test, security] | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'npm' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build package | |
run: npm run build:production | |
- name: Publish to NPM (if version changed) | |
run: | | |
# Only publish if package.json version is different from published version | |
CURRENT_VERSION=$(node -p "require('./package.json').version") | |
PUBLISHED_VERSION=$(npm view flowbite-vue version 2>/dev/null || echo "0.0.0") | |
if [ "$CURRENT_VERSION" != "$PUBLISHED_VERSION" ]; then | |
echo "Publishing version $CURRENT_VERSION (was $PUBLISHED_VERSION)" | |
npm publish | |
else | |
echo "Version $CURRENT_VERSION already published, skipping" | |
fi | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |