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
63 changes: 63 additions & 0 deletions .github/workflows/publish-backend.ai-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish Backend.ai-ui to npm registry

on:
push:
paths:
- packages/backend.ai-ui/**
branches:
- main
tags:
- v*

jobs:
publish:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: latest
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
registry-url: "https://registry.npmjs.org"
- name: Update npm
run: npm install -g npm@latest
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install

- name: Update to canary version
if: github.ref_type == 'branch'
run: |
cd packages/backend.ai-ui
./scripts/update-canary-version.sh
- name: Publish to npm (canary)
if: github.ref_type == 'branch'
run: |
cd packages/backend.ai-ui
npm publish --tag canary --access public --no-git-checks

- name: Publish to npm (latest)
if: github.ref_type == 'tag'
run: |
cd packages/backend.ai-ui
npm publish --tag latest --access public --no-git-checks
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21
22
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ versiontag:
@sed -i -E 's/globalThis.packageVersion = "\([^"]*\)"/globalThis.packageVersion = "${BUILD_VERSION}"/g' index.html
@sed -i -E 's/"version": "\([^"]*\)"/"version": "${BUILD_VERSION}"/g' manifest.json
@sed -i -E 's/"version": "\([^"]*\)"/"version": "${BUILD_VERSION}"/g' react/package.json
@sed -i -E 's/"version": "\([^"]*\)"/"version": "${BUILD_VERSION}"/g' packages/backend.ai-ui/package.json
@sed -i -E 's/"version": "\([^"]*\)"/"version": "${BUILD_VERSION}"/g' electron-app/package.json
@sed -i -E 's/globalThis.buildNumber = "\([^"]*\)"/globalThis.buildNumber = "${BUILD_NUMBER}"/g' index.html
@sed -i -E 's/\<small class="sidebar-footer" style="font-size:9px;"\>\([^"]*\)\<\/small\>/\<small class="sidebar-footer" style="font-size:9px;"\>${BUILD_VERSION}.${BUILD_NUMBER}\<\/small\>/g' ./src/components/backend-ai-webui.ts
Expand Down
28 changes: 21 additions & 7 deletions packages/backend.ai-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
{
"name": "backend.ai-ui",
"version": "1.0.0",
"private": true,
"description": "Shared UI components for Backend.AI",
"version": "25.16.0-alpha.0",
"description": "React components for Backend.AI",
"repository": {
"type": "git",
"url": "https://github.com/lablup/backend.ai-webui/tree/main/packages/backend.ai-ui"
},
"bugs": {
"url": "https://github.com/lablup/backend.ai-webui/issues"
},
"author": "Lablup Inc. <[email protected]>",
"license": "LGPL-3.0-or-later",
"keywords": [
"backend.ai",
"component",
"react"
],
"main": "./dist/backend.ai-ui.js",
"module": "./dist/backend.ai-ui.js",
"types": "./dist/index.d.ts",
"sideEffects": false,
"exports": {
".": {
Expand All @@ -24,7 +40,8 @@
"test": "NODE_OPTIONS='--no-deprecation' jest",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"lint": "eslint ./src --ignore-pattern '**.graphql.**' --max-warnings=0"
"lint": "eslint ./src --ignore-pattern '**.graphql.**' --max-warnings=0",
"prepublishOnly": "pnpm lint && pnpm test && pnpm build"
},
"eslintConfig": {
"extends": [
Expand Down Expand Up @@ -96,13 +113,10 @@
"relay-runtime": "^20.1.1"
},
"dependencies": {
"@ant-design/icons": "^5.6.1",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/modifiers": "^9.0.0",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@tanstack/react-query": "^5.69.0",
"ahooks": "^3.9.5",
"big.js": "^7.0.1",
"classnames": "^2.5.1",
"dayjs": "^1.11.18",
Expand Down
36 changes: 36 additions & 0 deletions packages/backend.ai-ui/scripts/update-canary-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PACKAGE_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
ROOT_DIR="$(cd "${PACKAGE_DIR}/../.." && pwd)"
PACKAGE_JSON="${PACKAGE_DIR}/package.json"
ROOT_PACKAGE_JSON="${ROOT_DIR}/package.json"

# Get commit hash and build date
COMMIT_HASH=$(git rev-parse --short=9 HEAD)
BUILD_DATE=$(date +%Y%m%d)

# Read the base version from root package.json
BASE_VERSION_FULL=$(node -p "require('${ROOT_PACKAGE_JSON}').version")
# Extract only the version part before the first '-' (e.g., 25.16.0-alpha.0 -> 25.16.0)
BASE_VERSION="${BASE_VERSION_FULL%%-*}"

# Create canary version (React style: version-canary-hash-date)
CANARY_VERSION="${BASE_VERSION}-canary-${COMMIT_HASH}-${BUILD_DATE}"

echo "Updating version to ${CANARY_VERSION}"
echo " Base version: ${BASE_VERSION}"
echo " Commit hash: ${COMMIT_HASH}"
echo " Build date: ${BUILD_DATE}"

# Update package.json version
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('${PACKAGE_JSON}', 'utf8'));
pkg.version = '${CANARY_VERSION}';
fs.writeFileSync('${PACKAGE_JSON}', JSON.stringify(pkg, null, 2) + '\n');
"

echo "Updated package.json version to ${CANARY_VERSION}"
Loading