Skip to content

feat(adapter-nextjs): add Next.js adapter package with unified CLI #57

feat(adapter-nextjs): add Next.js adapter package with unified CLI

feat(adapter-nextjs): add Next.js adapter package with unified CLI #57

Workflow file for this run

name: Release
on:
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
pull-requests: write
issues: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: github.repository == 'dawidurbanski/universal-data-layer'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# Fetch all history for all tags and branches
fetch-depth: 0
# Use a personal access token if available, otherwise use GITHUB_TOKEN
# For private repos, using a PAT is recommended
token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
- 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 packages
run: npm run build
- name: Run tests
run: npm run test:coverage
- name: Check coverage threshold
run: |
COVERAGE_SUMMARY=$(npm run test:coverage -- --reporter=json-summary 2>&1 | tail -n 1)
COVERAGE=$(echo "$COVERAGE_SUMMARY" | grep -oP '"pct":\s*\K[\d.]+' | head -1)
if [ -z "$COVERAGE" ]; then
echo "⚠️ Coverage data not available. Proceeding with release."
else
echo "Coverage: ${COVERAGE}%"
if (( $(echo "$COVERAGE < 90" | bc -l) )); then
echo "❌ Coverage ${COVERAGE}% is below the 90% threshold"
exit 1
else
echo "✅ Coverage ${COVERAGE}% meets the 90% threshold"
fi
fi
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
version: npm run version
commit: 'chore(release): version packages'
title: 'chore(release): version packages'
createGithubReleases: true
env:
# Use RELEASE_TOKEN if available (for private repos), otherwise GITHUB_TOKEN
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Send release notification
if: steps.changesets.outputs.published == 'true'
run: |
echo "🎉 Successfully published the following packages:"
echo "${{ steps.changesets.outputs.publishedPackages }}"