Skip to content

Commit d676c5b

Browse files
authored
Merge pull request #929 from LIT-Protocol/anson/cherry-pick-naga-workflows
feat: cherry-pick naga workflows
2 parents fd03769 + 01ee690 commit d676c5b

File tree

2 files changed

+117
-85
lines changed

2 files changed

+117
-85
lines changed

.github/workflows/prerelease.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Release
2+
on:
3+
workflow_run:
4+
workflows:
5+
- E2E - Naga (matrix)
6+
branches:
7+
- naga
8+
- canary-naga
9+
types:
10+
- completed
11+
12+
permissions:
13+
# allow pushing commits, creating tags, and modifying repo files
14+
# needed for the workflow to update package.json versions and CHANGELOG files
15+
contents: write
16+
pull-requests: write
17+
18+
concurrency:
19+
group: release-${{ github.event.workflow_run.head_branch || github.event.workflow_run.head_sha }}
20+
cancel-in-progress: false
21+
22+
jobs:
23+
release:
24+
runs-on: ubuntu-latest
25+
if: >-
26+
${{ github.event.workflow_run.conclusion == 'success' &&
27+
github.event.workflow_run.event == 'push' &&
28+
(github.event.workflow_run.head_branch == 'naga' ||
29+
github.event.workflow_run.head_branch == 'canary-naga') }}
30+
# Enable this when we want to implement docker image release
31+
# outputs:
32+
# published: ${{ steps.changesets.outputs.published }}
33+
# auth_server_published: ${{ steps.auth_server_release.outputs.published }}
34+
steps:
35+
- name: Check NPM Token
36+
run: |
37+
if [ -z "${{ secrets.NODE_AUTH_TOKEN }}" ]; then
38+
echo "❌ NODE_AUTH_TOKEN secret is not set. Please add it to repository secrets."
39+
exit 1
40+
else
41+
echo "✅ NODE_AUTH_TOKEN secret is available."
42+
fi
43+
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 0
48+
ref: ${{ github.event.workflow_run.head_sha }}
49+
50+
- name: Setup PNPM
51+
uses: pnpm/action-setup@v4
52+
with:
53+
version: 9.15.0
54+
55+
- name: Install rust
56+
uses: actions-rs/toolchain@v1
57+
with:
58+
toolchain: stable
59+
override: true
60+
components: rust-std
61+
62+
- name: Install wasm-pack
63+
uses: jetli/[email protected]
64+
with:
65+
version: '0.12.1'
66+
67+
- name: Setup Node
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version: '22.18.0'
71+
registry-url: 'https://registry.npmjs.org'
72+
cache: 'pnpm'
73+
cache-dependency-path: pnpm-lock.yaml
74+
75+
- name: Install project dependencies
76+
run: pnpm install --frozen-lockfile
77+
78+
- name: Check current pre-release mode
79+
run: |
80+
if [ -f ".changeset/pre.json" ]; then
81+
echo "📋 Current pre-release mode status:"
82+
cat .changeset/pre.json | jq '{ mode: .mode, tag: .tag }'
83+
else
84+
echo "📋 Not in pre-release mode"
85+
fi
86+
87+
- name: Create Release Pull Request or Publish to npm
88+
id: changesets
89+
uses: changesets/action@v1
90+
with:
91+
version: pnpm changeset version
92+
# Build immediately before publishing so artifacts reflect the freshly bumped version
93+
publish: pnpm build && pnpm changeset publish --access public
94+
commit: 'chore(release): version packages'
95+
title: 'chore(release): version packages'
96+
env:
97+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98+
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
99+
100+
# - Was lit-auth-server part of the most recent release?
101+
# - Capture published packages
102+
# - Fallback to empty array if nothing was published
103+
# - Search for the specific package
104+
# - 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.
105+
# - If the package is found, it writes published=true into the GitHub Actions step output.
106+
# - name: Check for lit-auth-server release
107+
# id: auth_server_release
108+
# run: |
109+
# packages='${{ steps.changesets.outputs.publishedPackages }}'
110+
# if [ -z "$packages" ]; then
111+
# packages='[]'
112+
# fi
113+
# if echo "$packages" | jq -e '.[] | select(.name == "lit-auth-server" or .name == "@lit-protocol/lit-auth-server")' > /dev/null; then
114+
# echo "published=true" >> "$GITHUB_OUTPUT"
115+
# else
116+
# echo "published=false" >> "$GITHUB_OUTPUT"
117+
# fi

0 commit comments

Comments
 (0)