From b98bbd3a5c776231b227ca5ca83513daafe1b74b Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 5 Mar 2026 09:06:51 +0530 Subject: [PATCH 1/3] chore: add release workflow for npm and docker Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release.yml | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) 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..9d9d757 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,72 @@ +name: release + +on: + release: + types: [published] + +jobs: + npm-release: + name: Publish to npm + runs-on: ubuntu-latest + timeout-minutes: 10 + defaults: + run: + working-directory: ./packages/chronicle + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + + - name: Install dependencies + run: bun install --frozen-lockfile + working-directory: . + + - name: Build CLI + run: bun build-cli.ts + + - name: Bump version + run: | + VERSION="${GITHUB_REF_NAME#v}" + npm version "$VERSION" --no-git-tag-version + + - name: Create .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish + run: npm publish --access public + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + docker-release: + name: Publish to Docker Hub + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + registry: docker.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set version + run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + raystack/chronicle:${{ env.VERSION }} + raystack/chronicle:latest From 24a26cfee6dd397d779e39311060c037f14c1f4a Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 5 Mar 2026 09:14:28 +0530 Subject: [PATCH 2/3] fix: address PR review comments for release workflow - Fix .npmrc whitespace issue by using echo instead of heredoc - Update docker/login-action v3 -> v4 - Update docker/build-push-action v5 -> v6 Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9d9d757..4935df4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,10 +32,7 @@ jobs: npm version "$VERSION" --no-git-tag-version - name: Create .npmrc - run: | - cat << EOF > "$HOME/.npmrc" - //registry.npmjs.org/:_authToken=$NPM_TOKEN - EOF + run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > "$HOME/.npmrc" env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} @@ -53,7 +50,7 @@ jobs: uses: actions/checkout@v4 - name: Login to DockerHub - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: docker.io username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -63,7 +60,7 @@ jobs: run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" - name: Build and push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . push: true From 1bf4985c44e93f7a24ce5c2bc030e869c1308101 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 5 Mar 2026 09:35:40 +0530 Subject: [PATCH 3/3] fix: add prerelease guard and idempotent version bump - Skip npm and docker publish for prerelease - Add --allow-same-version for re-run idempotency Co-Authored-By: Claude Opus 4.6 --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4935df4..651048d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: jobs: npm-release: name: Publish to npm + if: github.event.release.prerelease == false runs-on: ubuntu-latest timeout-minutes: 10 defaults: @@ -29,7 +30,7 @@ jobs: - name: Bump version run: | VERSION="${GITHUB_REF_NAME#v}" - npm version "$VERSION" --no-git-tag-version + npm version "$VERSION" --no-git-tag-version --allow-same-version - name: Create .npmrc run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > "$HOME/.npmrc" @@ -43,6 +44,7 @@ jobs: docker-release: name: Publish to Docker Hub + if: github.event.release.prerelease == false runs-on: ubuntu-latest timeout-minutes: 10 steps: