From af6bf2e6da3b5448537ce73ee79bef4ad925ce53 Mon Sep 17 00:00:00 2001 From: Konstantin Tarkus Date: Sat, 24 Jan 2026 20:29:37 +0100 Subject: [PATCH] ci: add npm publish workflow with provenance Adds GitHub Actions workflow that publishes to npm when version tags are pushed. Uses npm provenance for supply chain security. --- .github/workflows/release.yml | 25 +++++++++++++++++++++++++ docs/configuration.md | 16 +++++++++++++++- package.json | 2 +- src/config.ts | 2 +- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d8e14b7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,25 @@ +name: Release + +on: + push: + tags: ["v*"] + +jobs: + publish: + runs-on: ubuntu-latest + environment: release + permissions: + id-token: write + contents: read + steps: + - uses: actions/checkout@v6 + - uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://registry.npmjs.org + - run: bun install --frozen-lockfile + - run: bun run build + - run: npm publish --provenance --access public diff --git a/docs/configuration.md b/docs/configuration.md index 37f7838..00ff00c 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -27,7 +27,7 @@ export default defineConfig({ | Option | Type | Default | Description | | ------------- | --------- | --------------- | -------------------------------------- | | `root` | `string` | `process.cwd()` | Project root directory | -| `outDir` | `string` | `.srcpack` | Output directory for bundles | +| `outDir` | `string` | `.srcpack` | Output directory (relative to root) | | `emptyOutDir` | `boolean` | `true`\* | Empty output directory before bundling | | `bundles` | `object` | — | Named bundles (required) | | `upload` | `object` | — | Upload destination | @@ -47,6 +47,20 @@ export default defineConfig({ }); ``` +### outDir + +Output directory for bundle files. Can be absolute or relative to project root. + +```ts +export default defineConfig({ + root: "./packages/app", + outDir: "dist", // writes to packages/app/dist/ + bundles: { + app: "src/**/*", + }, +}); +``` + ## Bundle Definitions Each bundle can be defined in three ways: diff --git a/package.json b/package.json index 7241401..47ac4d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "srcpack", - "version": "0.1.13", + "version": "0.1.14", "description": "Zero-config CLI for bundling code into LLM-optimized context files", "keywords": [ "llm", diff --git a/src/config.ts b/src/config.ts index 097d5be..02d8840 100644 --- a/src/config.ts +++ b/src/config.ts @@ -72,7 +72,7 @@ const ConfigSchema = z.object({ * @default process.cwd() */ root: z.string().default(""), - /** Output directory for bundle files. Defaults to ".srcpack". */ + /** Output directory for bundle files (relative to root). Defaults to ".srcpack". */ outDir: z.string().default(".srcpack"), /** Empty outDir before bundling. Auto-enabled when outDir is inside project root. */ emptyOutDir: z.boolean().optional(),