Skip to content

Commit 2c25a2f

Browse files
authored
Publish (#48)
* [publish] add yml * add main check * [publish] up version
1 parent fe75977 commit 2c25a2f

2 files changed

Lines changed: 65 additions & 1 deletion

File tree

.github/workflows/cli-publish.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Publish CLI to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'cli-[0-9]+.[0-9]+.[0-9]+'
7+
8+
permissions: {}
9+
10+
jobs:
11+
publish:
12+
name: Publish @stakewise/create-vault-interface
13+
runs-on: ubuntu-latest
14+
environment:
15+
name: npm-publish-cli
16+
url: https://www.npmjs.com/package/@stakewise/create-vault-interface
17+
permissions:
18+
contents: read
19+
id-token: write
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd
23+
with:
24+
persist-credentials: false
25+
26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1
28+
with:
29+
version: 10.25.0
30+
31+
- name: Setup Node
32+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f
33+
with:
34+
cache: pnpm
35+
node-version: '24.12.0'
36+
registry-url: 'https://registry.npmjs.org'
37+
38+
- name: Verify tag matches cli/package.json version
39+
run: |
40+
TAG_VERSION="${GITHUB_REF_NAME#cli-}"
41+
PKG_VERSION=$(node -p "require('./cli/package.json').version")
42+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
43+
echo "::error::Tag $GITHUB_REF_NAME (parsed as $TAG_VERSION) does not match cli/package.json version $PKG_VERSION"
44+
exit 1
45+
fi
46+
47+
- name: Verify tag is on main
48+
run: |
49+
git fetch origin main --depth=1
50+
if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then
51+
echo "::error::Tag $GITHUB_REF_NAME points to commit $GITHUB_SHA which is not on main branch"
52+
exit 1
53+
fi
54+
55+
- name: Install dependencies
56+
run: pnpm install --frozen-lockfile --ignore-scripts
57+
58+
- name: Build CLI
59+
working-directory: cli
60+
run: pnpm build
61+
62+
- name: Publish to npm with provenance
63+
working-directory: cli
64+
run: npm publish --provenance --access public --ignore-scripts

cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stakewise/create-vault-interface",
3-
"version": "0.1.4",
3+
"version": "0.1.5",
44
"description": "CLI for creating a StakeWise Vault Interface application",
55
"type": "module",
66
"scripts": {

0 commit comments

Comments
 (0)