Skip to content
Closed
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-package-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Publish (Internal)

on:
push:
branches:
- main

permissions:
contents: read

jobs:
publish-package:
runs-on: ubuntu-latest
environment: artifactory-prod
steps:
- uses: actions/checkout@v4

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

- name: Enable Corepack
run: corepack enable

- name: Get yarn cache directory
id: yarn-cache-dir
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: Cache yarn dependencies
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-

- name: Configure JFrog Artifactory
run: |
echo "npmRegistryServer: ${{ secrets.JFROG_ARTIFACTORY_NPM_VIRTUAL_URL }}" >> .yarnrc.yml
echo "npmAuthIdent: ${{ secrets.JFROG_ARTIFACTORY_READ_NPM_AUTH }}" >> .yarnrc.yml
echo "npmAlwaysAuth: true" >> .yarnrc.yml

- name: Install dependencies
run: yarn install --immutable

- name: Build package
run: yarn build

- name: Update version for internal release
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
NEW_VERSION="${CURRENT_VERSION}-beta.${{ github.run_number }}"
npm version $NEW_VERSION --no-git-tag-version
echo "Publishing version: $NEW_VERSION"

- name: Configure JFrog Artifactory (Publish)
run: |
sed -i "s|npmRegistryServer: .*|npmRegistryServer: ${{ secrets.JFROG_ARTIFACTORY_WRITE_NPM_URL }}|g" .yarnrc.yml
sed -i "s|npmAuthIdent: .*|npmAuthIdent: ${{ secrets.JFROG_ARTIFACTORY_WRITE_NPM_AUTH }}|g" .yarnrc.yml

- name: Publish package
run: yarn npm publish --tag beta

65 changes: 65 additions & 0 deletions .github/workflows/publish-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Publish PR

on:
pull_request:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow runs on pull_request but uses Artifactory write secrets later; that can both fail for forked PRs (secrets unavailable) and expose secrets to untrusted PR code in same-repo contributions. Consider gating the job to non-fork PRs / trusted actors (or using a pull_request_target-based flow with careful checkout) to avoid accidental secret exposure.

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎

branches:
- main

permissions:
contents: read

jobs:
publish-package:
runs-on: ubuntu-latest
environment: artifactory-prod
# Only run on non-forked PRs to prevent secret exposure
if: github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v4

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

- name: Enable Corepack
run: corepack enable

- name: Get yarn cache directory
id: yarn-cache-dir
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: Cache yarn dependencies
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-

- name: Configure JFrog Artifactory
run: |
echo "npmRegistryServer: ${{ secrets.JFROG_ARTIFACTORY_NPM_VIRTUAL_URL }}" >> .yarnrc.yml
echo "npmAuthIdent: ${{ secrets.JFROG_ARTIFACTORY_READ_NPM_AUTH }}" >> .yarnrc.yml
echo "npmAlwaysAuth: true" >> .yarnrc.yml

- name: Install dependencies
run: yarn install --immutable

- name: Build package
run: yarn build

- name: Update version for PR release
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
NEW_VERSION="${CURRENT_VERSION}-alpha.${{ github.run_number }}"
npm version $NEW_VERSION --no-git-tag-version
echo "Publishing version: $NEW_VERSION"

- name: Configure JFrog Artifactory (Publish)
run: |
sed -i "s|npmRegistryServer: .*|npmRegistryServer: ${{ secrets.JFROG_ARTIFACTORY_WRITE_NPM_URL }}|g" .yarnrc.yml
sed -i "s|npmAuthIdent: .*|npmAuthIdent: ${{ secrets.JFROG_ARTIFACTORY_WRITE_NPM_AUTH }}|g" .yarnrc.yml

- name: Publish package
run: yarn npm publish --tag alpha

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ This library provides:
## Installation

```bash
yarn add @tetrascience-npm/tetrascience-react-ui
yarn add @tetrascience/tetrascience-react-ui
```

## Quick Start

```tsx
// 1. Import the CSS (required)
import '@tetrascience-npm/tetrascience-react-ui/index.css';
import '@tetrascience/tetrascience-react-ui/index.css';

// 2. Import components
import { Button, Card, BarGraph } from '@tetrascience-npm/tetrascience-react-ui';
import { Button, Card, BarGraph } from '@tetrascience/tetrascience-react-ui';

function App() {
return (
Expand Down Expand Up @@ -53,7 +53,7 @@ AppLayout, AreaGraph, BarGraph, Boxplot, Chromatogram, DotPlot, Heatmap, Histogr
Customise colours, border radius, and spacing:

```tsx
import { ThemeProvider } from '@tetrascience-npm/tetrascience-react-ui';
import { ThemeProvider } from '@tetrascience/tetrascience-react-ui';

const customTheme = {
colors: {
Expand All @@ -77,8 +77,8 @@ See [THEMING.md](./THEMING.md) for the complete theming guide.
Full TypeScript support with exported types:

```tsx
import { Button } from '@tetrascience-npm/tetrascience-react-ui';
import type { ButtonProps, BarGraphProps, BarDataSeries } from '@tetrascience-npm/tetrascience-react-ui';
import { Button } from '@tetrascience/tetrascience-react-ui';
import type { ButtonProps, BarGraphProps, BarDataSeries } from '@tetrascience/tetrascience-react-ui';
```

## Examples
Expand Down
2 changes: 1 addition & 1 deletion THEMING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The TetraScience UI Kit supports custom theming through the `ThemeProvider` comp
Wrap your application with the `ThemeProvider` and pass a custom theme object:

```tsx
import { ThemeProvider, Button, Card, Modal } from '@tetrascience-npm/tetrascience-react-ui';
import { ThemeProvider, Button, Card, Modal } from '@tetrascience/tetrascience-react-ui';

const customTheme = {
colors: {
Expand Down
2 changes: 1 addition & 1 deletion examples/vite-themed-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@tetrascience-npm/tetrascience-react-ui": "workspace:*",
"@tetrascience/tetrascience-react-ui": "workspace:*",
"react": "^18.3.0",
"react-dom": "^18.3.0"
},
Expand Down
Loading
Loading