Skip to content
Merged
Show file tree
Hide file tree
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
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
release:
types: [published]

permissions:
contents: read
id-token: write

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org

- run: pnpm install --frozen-lockfile

- run: pnpm typecheck

- run: pnpm test

- run: pnpm build

- name: Verify package version matches release tag
run: |
RELEASE_TAG="${GITHUB_REF_NAME#v}"
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
if [ "$RELEASE_TAG" != "$PACKAGE_VERSION" ]; then
echo "GitHub release tag ($RELEASE_TAG) does not match package.json version ($PACKAGE_VERSION)"
exit 1
fi

- run: npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/storybook-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Deploy Storybook to Pages

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
node-version: 20

- run: pnpm install --frozen-lockfile

- run: pnpm build-storybook

- uses: actions/configure-pages@v5

- uses: actions/upload-pages-artifact@v3
with:
path: storybook-static

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const config: StorybookConfig = {
],
"framework": "@storybook/react-vite",
async viteFinal(viteConfig) {
viteConfig.base = "./";
viteConfig.plugins ??= [];
viteConfig.plugins.push(tailwindcss());
viteConfig.resolve ??= {};
Expand Down
1 change: 1 addition & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { withThemeByClassName } from '@storybook/addon-themes'
import './theme.css'

const preview: Preview = {
tags: ['autodocs'],
parameters: {
controls: {
matchers: {
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,13 @@ This runs `tsdown`, which bundles `src/index.ts` into ESM and CJS output with ty

## Publishing

Ewa UI is published to npm under the `@spatialnode` organization as [`@spatialnode/ewa-ui`](https://www.npmjs.com/package/@spatialnode/ewa-ui).
Ewa UI is published to npm under the `@spatialnode` organization as [`@spatialnode/ewa-ui`](https://www.npmjs.com/package/@spatialnode/ewa-ui). Releases are triggered from GitHub, not published manually from a local machine.

```bash
pnpm build
npm publish --access public
```
1. Bump `version` in `package.json` (merge that change to `main` first, following the normal PR workflow).
2. On GitHub, [create a new Release](https://github.com/Spatialnode/ewa-ui/releases/new) with tag `vX.Y.Z` matching the `package.json` version (e.g. `v0.1.0`), targeting `main`.
3. Publishing the release triggers `.github/workflows/release.yml`, which runs typecheck, tests, and `pnpm build`, verifies the tag matches `package.json`, then runs `npm publish --access public --provenance`.

Ensure you're logged in to npm (`npm login`) with an account that belongs to the `spatialnode` org before publishing.
This requires an `NPM_TOKEN` repo secret (an npm **automation** token for an account in the `spatialnode` org — automation tokens bypass 2FA for CI) configured under repo Settings → Secrets and variables → Actions.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spatialnode/ewa-ui",
"version": "1.0.0",
"version": "0.1.0",
"description": "Spatialnode React component library",
"type": "module",
"main": "./dist/index.cjs",
Expand Down
54 changes: 0 additions & 54 deletions src/stories/Button.stories.ts

This file was deleted.

37 changes: 0 additions & 37 deletions src/stories/Button.tsx

This file was deleted.

Loading