diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index ddf34f4e2..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,179 +0,0 @@ -name: Release -on: - workflow_run: - workflows: - - E2E - Naga (matrix) - branches: - - naga - - canary-naga - types: - - completed - -permissions: - # allow pushing commits, creating tags, and modifying repo files - # needed for the workflow to update package.json versions and CHANGELOG files - contents: write - pull-requests: write - -concurrency: - group: release-${{ github.event.workflow_run.head_branch || github.event.workflow_run.head_sha }} - cancel-in-progress: false - -jobs: - release: - runs-on: ubuntu-latest - if: >- - ${{ github.event.workflow_run.conclusion == 'success' && - github.event.workflow_run.event == 'push' && - (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 - # outputs: - # published: ${{ steps.changesets.outputs.published }} - # auth_server_published: ${{ steps.auth_server_release.outputs.published }} - steps: - - name: Check NPM Token - run: | - if [ -z "${{ secrets.NODE_AUTH_TOKEN }}" ]; then - echo "❌ NODE_AUTH_TOKEN secret is not set. Please add it to repository secrets." - exit 1 - else - echo "✅ NODE_AUTH_TOKEN secret is available." - fi - - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.event.workflow_run.head_sha }} - - - name: Setup PNPM - uses: pnpm/action-setup@v4 - with: - version: 9.15.0 - - - name: Install rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - components: rust-std - - - name: Install wasm-pack - uses: jetli/wasm-pack-action@v0.4.0 - with: - version: 'latest' - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: '22.18.0' - registry-url: 'https://registry.npmjs.org' - cache: 'pnpm' - cache-dependency-path: pnpm-lock.yaml - - - name: Install project dependencies - run: pnpm install --frozen-lockfile - - - name: Check current pre-release mode - run: | - if [ -f ".changeset/pre.json" ]; then - echo "📋 Current pre-release mode status:" - cat .changeset/pre.json | jq '{ mode: .mode, tag: .tag }' - else - echo "📋 Not in pre-release mode" - fi - - - 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: | - BRANCH="${{ github.event.workflow_run.head_branch }}" - git fetch --no-tags --prune --depth=1 origin "$BRANCH" - TIP_SHA=$(git rev-parse --verify "origin/$BRANCH^{commit}") - echo "Resolved branch tip SHA: $TIP_SHA" - echo "sha=$TIP_SHA" >> "$GITHUB_OUTPUT" - - - name: Reset release branch base - run: | - BRANCH="${{ github.event.workflow_run.head_branch }}" - git fetch --no-tags --prune origin - if git ls-remote --heads origin "changeset-release/$BRANCH" | grep -q .; then - git push origin :changeset-release/$BRANCH - echo "Deleted remote release branch changeset-release/$BRANCH" - else - echo "Remote release branch changeset-release/$BRANCH not found; nothing to delete" - fi - - - name: Create Release Pull Request or Publish to npm - id: changesets - uses: changesets/action@v1 - with: - branch: ${{ github.event.workflow_run.head_branch || 'naga' }} - version: pnpm changeset version - publish: pnpm changeset publish --access public - commit: 'chore(release): version packages' - title: 'chore(release): version packages' - 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 - # - Search for the specific package - # - Using jq, it inspects the JSON array of published packages, checking if any have a .name equal to either lit-auth-server or @lit-protocol/lit-auth-server. - # - If the package is found, it writes published=true into the GitHub Actions step output. - # - name: Check for lit-auth-server release - # id: auth_server_release - # run: | - # packages='${{ steps.changesets.outputs.publishedPackages }}' - # if [ -z "$packages" ]; then - # packages='[]' - # fi - # if echo "$packages" | jq -e '.[] | select(.name == "lit-auth-server" or .name == "@lit-protocol/lit-auth-server")' > /dev/null; then - # echo "published=true" >> "$GITHUB_OUTPUT" - # else - # echo "published=false" >> "$GITHUB_OUTPUT" - # fi