95 lines
2.2 KiB
YAML
95 lines
2.2 KiB
YAML
name: "@luzzle/cli"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- '@luzzle/cli@*'
|
|
paths:
|
|
- 'apps/cli/**'
|
|
- 'apps/core/**'
|
|
- '.github/workflows/cli.yml'
|
|
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'apps/cli/**'
|
|
- 'apps/core/**'
|
|
- '.github/workflows/cli.yml'
|
|
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
|
|
jobs:
|
|
ci:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '26'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build Core
|
|
run: pnpm --filter @luzzle/core build
|
|
|
|
- name: Build CLI
|
|
run: pnpm --filter @luzzle/cli build
|
|
|
|
- name: Lint
|
|
run: pnpm --filter @luzzle/cli lint
|
|
|
|
- name: Test
|
|
run: pnpm --filter @luzzle/cli test
|
|
|
|
publish:
|
|
needs: ci
|
|
if: github.ref_type == 'tag' && startsWith(github.ref_name, '@luzzle/cli@')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v6
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '26'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
cache: 'pnpm'
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build
|
|
run: pnpm --filter @luzzle/core --filter @luzzle/cli build
|
|
|
|
- name: Check Version
|
|
run: |
|
|
VERSION_FROM_PKG=$(node -p "require('./apps/cli/package.json').version")
|
|
TAG_NAME=${GITHUB_REF#refs/tags/}
|
|
VERSION_FROM_TAG=${TAG_NAME#@luzzle/cli@}
|
|
|
|
if [ "$VERSION_FROM_TAG" != "$VERSION_FROM_PKG" ]; then
|
|
echo "Version mismatch: Tag version $VERSION_FROM_TAG does not match package.json version $VERSION_FROM_PKG"
|
|
exit 1
|
|
fi
|
|
echo "Version $VERSION_FROM_PKG matches."
|
|
|
|
- name: Publish
|
|
run: pnpm --filter @luzzle/cli publish --no-git-checks --access public
|