Skip to content

Commit 2820aa0

Browse files
authored
Gds cli (#51)
* feat: add core functionality for vulnerability analysis and fix planning - Implemented configuration loading with environment variable support. - Added constants for GitHub API and default settings. - Created fix planner to generate actionable plans for vulnerabilities. - Developed GitHub service for interacting with GitHub repositories. - Introduced progress tracking for CLI operations. - Defined types for dependencies, vulnerabilities, and analysis results. - Added utility functions for formatting analysis and fix plan outputs. - Created a test API for validating programmatic interactions. - Configured TypeScript settings for building and type declarations. * vercelignore * feat: add GitHub Actions workflow for publishing CLI to npm
1 parent 5fd9317 commit 2820aa0

2 files changed

Lines changed: 76 additions & 2 deletions

File tree

.github/workflows/publish-cli.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Publish CLI to npm
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'packages/cli/**'
9+
- '.github/workflows/publish-cli.yml'
10+
workflow_dispatch:
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
id-token: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
registry-url: 'https://registry.npmjs.org'
28+
29+
- name: Setup Bun
30+
uses: oven-sh/setup-bun@v2
31+
with:
32+
bun-version: latest
33+
34+
- name: Install dependencies
35+
working-directory: packages/cli
36+
run: bun install
37+
38+
- name: Build package
39+
working-directory: packages/cli
40+
run: bun run build
41+
42+
- name: Check if version changed
43+
id: version-check
44+
working-directory: packages/cli
45+
run: |
46+
PACKAGE_NAME=$(node -p "require('./package.json').name")
47+
LOCAL_VERSION=$(node -p "require('./package.json').version")
48+
NPM_VERSION=$(npm view $PACKAGE_NAME version 2>/dev/null || echo "0.0.0")
49+
50+
echo "local_version=$LOCAL_VERSION" >> $GITHUB_OUTPUT
51+
echo "npm_version=$NPM_VERSION" >> $GITHUB_OUTPUT
52+
53+
if [ "$LOCAL_VERSION" != "$NPM_VERSION" ]; then
54+
echo "should_publish=true" >> $GITHUB_OUTPUT
55+
echo "📦 Version changed: $NPM_VERSION → $LOCAL_VERSION"
56+
else
57+
echo "should_publish=false" >> $GITHUB_OUTPUT
58+
echo "⏭️ Version unchanged ($LOCAL_VERSION), skipping publish"
59+
fi
60+
61+
- name: Publish to npm
62+
if: steps.version-check.outputs.should_publish == 'true'
63+
working-directory: packages/cli
64+
run: npm publish --access public --provenance
65+
env:
66+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
67+
68+
- name: Summary
69+
run: |
70+
if [ "${{ steps.version-check.outputs.should_publish }}" == "true" ]; then
71+
echo "### ✅ Published gitdepsec@${{ steps.version-check.outputs.local_version }} to npm" >> $GITHUB_STEP_SUMMARY
72+
else
73+
echo "### ⏭️ Skipped publishing (version ${{ steps.version-check.outputs.local_version }} already exists)" >> $GITHUB_STEP_SUMMARY
74+
fi

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ out/
2020
/backend/graph_image-*
2121
.VSCODECounter
2222
*.bak
23-
.github/
24-
.claude/
23+
.claude/
24+
.tsbuildinfo

0 commit comments

Comments
 (0)