From da5dfe3a5abaddfa2410234e9e055bd9e4a72f29 Mon Sep 17 00:00:00 2001 From: Vorflux AI Date: Fri, 17 Apr 2026 01:17:55 +0000 Subject: [PATCH 1/2] fix: convert publish workflow to merge-to-main with correct working directory - Trigger on push to main when packages/code-chunk/package.json changes (instead of tag-based) - Fix working directory from packages/astchunk to packages/code-chunk - Add actions/setup-node with registry-url for proper npm auth - Use NODE_AUTH_TOKEN instead of NPM_CONFIG_TOKEN - Add npm provenance support via id-token: write - Remove changelog generation step (not needed for auto-publish) --- .github/workflows/release.yml | 39 ++++++++++++++++------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a268dd9..42a483d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,23 +1,26 @@ -name: Release +name: Publish Package on: push: - tags: - - 'v*' - -permissions: - contents: write - id-token: write + branches: + - main + paths: + - "packages/code-chunk/package.json" jobs: - release: - name: Release Package + publish: runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - - name: Checkout code + - name: Checkout uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 with: - fetch-depth: 0 + registry-url: 'https://registry.npmjs.org' - name: Setup Bun uses: oven-sh/setup-bun@v2 @@ -36,15 +39,9 @@ jobs: - name: Build run: bun run build - - name: Generate changelog - run: bunx changelogithub - continue-on-error: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish to npm - run: bun publish --access public - working-directory: packages/astchunk + - name: Publish + run: npm publish --access public + working-directory: packages/code-chunk env: - NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_CONFIG_PROVENANCE: true + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 564654d1e8e31d5c7e8550637c22258daf62e499 Mon Sep 17 00:00:00 2001 From: Dhravya Shah Date: Thu, 16 Apr 2026 18:43:51 -0700 Subject: [PATCH 2/2] ci: fix publish workflow and convert to merge-to-main --- .github/workflows/release.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42a483d..47233da 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - registry-url: 'https://registry.npmjs.org' + registry-url: "https://registry.npmjs.org" - name: Setup Bun uses: oven-sh/setup-bun@v2 @@ -30,16 +30,34 @@ jobs: - name: Install dependencies run: bun install --frozen-lockfile + - name: Check if version changed + id: version-check + run: | + PACKAGE_NAME=$(jq -r '.name' packages/code-chunk/package.json) + LOCAL_VERSION=$(jq -r '.version' packages/code-chunk/package.json) + NPM_VERSION=$(npm view "$PACKAGE_NAME" version 2>/dev/null || echo "0.0.0") + if [ "$LOCAL_VERSION" = "$NPM_VERSION" ]; then + echo "Version $LOCAL_VERSION already published, skipping." + echo "changed=false" >> "$GITHUB_OUTPUT" + else + echo "Publishing $LOCAL_VERSION (npm has $NPM_VERSION)" + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + - name: Type check + if: steps.version-check.outputs.changed == 'true' run: bun run type-check - name: Lint + if: steps.version-check.outputs.changed == 'true' run: bun run lint - name: Build + if: steps.version-check.outputs.changed == 'true' run: bun run build - name: Publish + if: steps.version-check.outputs.changed == 'true' run: npm publish --access public working-directory: packages/code-chunk env: