Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 45 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
if: >-
${{ github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
github.repository == 'LIT-Protocol/js-sdk' &&
(github.event.workflow_run.head_branch == 'naga' ||
github.event.workflow_run.head_branch == 'canary-naga') }}
# Enable this when we want to implement docker image release
Expand All @@ -46,7 +45,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_branch }}
ref: ${{ github.event.workflow_run.head_sha }}

- name: Setup PNPM
uses: pnpm/action-setup@v4
Expand All @@ -73,18 +72,6 @@ jobs:
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml

- name: Print repo and branch context
run: |
echo "Repo: $GITHUB_REPOSITORY"
echo "Head branch: ${{ github.event.workflow_run.head_branch }}"
echo "Workflow head_sha: ${{ github.event.workflow_run.head_sha }}"
echo "Checked out ref: $(git rev-parse --abbrev-ref HEAD)"
echo "Current commit: $(git rev-parse HEAD)"
echo "Node: $(node -v)"
echo "PNPM: $(pnpm --version)"
[ -f pnpm-lock.yaml ] && echo "pnpm-lock.yaml present" || echo "pnpm-lock.yaml missing"
[ -d .changeset ] && echo ".changeset present" || echo ".changeset missing"

- name: Install project dependencies
run: pnpm install --frozen-lockfile

Expand All @@ -100,6 +87,26 @@ jobs:
- name: Build packages
run: pnpm run build

- name: Preflight diagnostics
run: |
echo "Repo: $GITHUB_REPOSITORY"
echo "Head branch: ${{ github.event.workflow_run.head_branch }}"
echo "Workflow head_sha: ${{ github.event.workflow_run.head_sha }}"
echo "Checked out ref: $(git rev-parse --abbrev-ref HEAD)"
echo "Current commit: $(git rev-parse HEAD)"
echo "Node: $(node -v)"
echo "PNPM: $(pnpm --version)"
[ -f pnpm-lock.yaml ] && echo "pnpm-lock.yaml present" || echo "pnpm-lock.yaml missing"
if [ -d .changeset ]; then
echo ".changeset present" && ls -la .changeset
if [ -f .changeset/config.json ]; then
echo "changeset config (baseBranch + mode if pre):"
jq '{ baseBranch: .baseBranch, pre: .pre }' .changeset/config.json || cat .changeset/config.json
fi
else
echo ".changeset missing"
fi

- name: Compute branch tip SHA
id: branch_tip
run: |
Expand All @@ -109,6 +116,11 @@ jobs:
echo "Resolved branch tip SHA: $TIP_SHA"
echo "sha=$TIP_SHA" >> "$GITHUB_OUTPUT"

- name: Reset release branch base
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The step name 'Reset release branch base' is misleading as the step actually deletes a remote changeset release branch. Consider renaming to 'Clean up existing changeset release branch' or 'Delete previous changeset release branch' for clarity.

Suggested change
- name: Reset release branch base
- name: Delete previous changeset release branch

Copilot uses AI. Check for mistakes.
run: |
git fetch --no-tags --prune origin
git push origin :changeset-release/${{ github.event.workflow_run.head_branch }} || true

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
Expand All @@ -118,11 +130,30 @@ jobs:
publish: pnpm changeset publish --access public
commit: 'chore(release): version packages'
title: 'chore(release): version packages'
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commitMode: github parameter should be documented with a comment explaining why this mode is used instead of the default, especially in the context of fixing the Changesets reset issue mentioned in the PR title.

Suggested change
title: 'chore(release): version packages'
title: 'chore(release): version packages'
# Use commitMode: github to avoid Changesets reset issue (see PR title for context).

Copilot uses AI. Check for mistakes.
commitMode: github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
GITHUB_SHA: ${{ steps.branch_tip.outputs.sha }}

- name: Post-mortem diagnostics (on failure)
if: failure()
run: |
echo "After changesets/action failure:"
echo "Branch refs:"
git branch -vv || true
echo "HEAD now: $(git rev-parse HEAD)"
git show -s --date=iso --format='%h %ad %s' || true
echo "Workspace root listing:"
ls -la || true
if [ -d .changeset ]; then
echo ".changeset dir exists after failure:" && ls -la .changeset || true
else
echo ".changeset dir missing after failure"
fi
echo "Last 10 reflog entries:"
git reflog --date=iso -n 10 --decorate || true

# - Was lit-auth-server part of the most recent release?
# - Capture published packages
# - Fallback to empty array if nothing was published
Expand Down