Skip to content

Commit

Permalink
chore: allow consolidated storybook to reference local storybook inst…
Browse files Browse the repository at this point in the history
…ances (#386)

* chore: add local references for storybook

* chore: add canary releases back in for now

* chore: format
  • Loading branch information
annawen1 authored Jan 28, 2025
1 parent 6d9fce6 commit ffcf8cf
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 112 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release - canary

on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release-canary:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
if: |
github.repository == 'carbon-design-system/carbon-labs'
timeout-minutes: 60
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- run: |
git config user.name carbon-bot
git config user.email [email protected]
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Build project
run: yarn build
- name: Set NPM token
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
- name: Publish canary release of packages
run: |
yarn lerna publish --canary --preid canary --dist-tag canary --yes
88 changes: 0 additions & 88 deletions .github/workflows/release-deprecated.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/release-minor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

## on every merge to the main branch, lerna will publish a minor version for packages that have been modified
on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
# if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
timeout-minutes: 60
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- run: |
git config user.name carbon-bot
git config user.email [email protected]
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: Build project
run: yarn build
- name: Set NPM token
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
- name: Publish minor release of packages
run: |
yarn lerna publish minor --dist-tag latest --yes --message 'chore: release'
env:
GITHUB_TOKEN: ${{ secrets.MERGE_ACTION }}
71 changes: 57 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,49 @@
name: Release

## on every merge to the main branch, lerna will publish a minor version for packages that have been modified
on:
push:
branches:
- main
run-name:
${{ inputs.type }} - dry-run:${{ inputs.dry-run }} by @${{ github.actor }}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
workflow_dispatch:
inputs:
type:
required: true
description: 'Specify the type of release'
type: choice
default: first minor rc
options:
- full minor release
- first minor rc
- full patch release
- first patch rc
- subsequent rc
dry-run:
required: true
description: 'Run dry run?'
type: boolean
default: true

jobs:
release:
# if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
if: |
github.repository == 'carbon-design-system/carbon-labs'
timeout-minutes: 60
env:
GH_TOKEN: ${{ secrets.MERGE_ACTION }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: '0'
- run: |
git config user.name carbon-bot
git config user.email [email protected]
git config --global user.email ${{ secrets.CARBON_BOT_EMAIL }}
git config --global user.name ${{ secrets.CARBON_BOT_NAME }}
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
Expand All @@ -37,9 +56,33 @@ jobs:
- name: Set NPM token
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
- name: Publish minor release of packages
- name: Set dry run env variable
run: |
if [ "${{ github.event.inputs.dry-run }}" == "false" ]; then
echo "DRY_RUN=--yes" >> $GITHUB_ENV
fi
- name: Publish full minor release (ie. v1.x.0)
if: github.event.inputs.type == 'full minor release'
run: |
echo "DRY RUN: ${{ env.DRY_RUN }}"
yarn lerna publish minor --conventional-graduate $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")
- name: Publish first minor RC (ie. v1.x.0-rc.0)
if: github.event.inputs.type == 'first minor rc'
run: |
echo "DRY RUN: ${{ env.DRY_RUN }}"
yarn lerna publish preminor --conventional-prerelease --preid rc --pre-dist-tag next $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")
- name: Publish full patch release (ie. v1.0.x)
if: github.event.inputs.type == 'full patch release'
run: |
echo "DRY RUN: ${{ env.DRY_RUN }}"
yarn lerna publish patch --conventional-graduate $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")
- name: Publish first patch RC (ie. v1.0.x-rc.0)
if: github.event.inputs.type == 'first patch rc'
run: |
echo "DRY RUN: ${{ env.DRY_RUN }}"
yarn lerna publish prepatch --conventional-prerelease --preid rc --pre-dist-tag next $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")
- name: Publish subsequent RC (ie. v1.0.0-rc.x)
if: github.event.inputs.type == 'subsequent rc'
run: |
yarn lerna publish minor --dist-tag latest --yes --message 'chore: release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.MERGE_ACTION }}
echo "DRY RUN: ${{ env.DRY_RUN }}"
yarn lerna publish --conventional-prerelease --preid rc --pre-dist-tag next $(echo "${{ env.DRY_RUN }}") $(echo "${{ env.FORCE_PUBLISH }}")
32 changes: 23 additions & 9 deletions .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,29 @@ const config = {
name: getAbsolutePath('@storybook/web-components-vite'),
options: {},
},
refs: {
'web-components': {
title: 'Web Components',
url: 'https://labs.carbondesignsystem.com/web-components',
},
react: {
title: 'React components',
url: 'https://labs.carbondesignsystem.com/react',
},
refs: (config, { configType }) => {
if (configType === 'DEVELOPMENT') {
return {
'web-components': {
title: 'Web Components',
url: 'http://localhost:6007',
},
react: {
title: 'React components',
url: 'http://localhost:6008',
},
};
}
return {
'web-components': {
title: 'Web Components',
url: 'https://labs.carbondesignsystem.com/web-components',
},
react: {
title: 'React components',
url: 'https://labs.carbondesignsystem.com/react',
},
};
},
};
export default config;
29 changes: 28 additions & 1 deletion docs/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,43 @@ Afterwards, you should be good to go!

## Running Storybook

To get your development server running and to start coding, you just have to
To get your development server running specifically for Web Components or React,
run:

```bash
cd packages/web-components
yarn storybook
```

or

```bash
cd packages/react
yarn storybook
```

This will start a development server where you can see any changes you are
making to components in Storybook.

To get the consolidated view of both Web Components and React within one
Storybook environment, you need to have Storybook running for both before
running Storybook from the root of the project.

```bash
cd packages/web-components
yarn storybook

cd ../react
yarn storybook

cd ../..
yarn storybook
```

The
[Storybook references](https://github.com/carbon-design-system/carbon-labs/blob/main/.storybook/main.js)
can be modified if needed.

## Common tasks

While working on Carbon Labs, here are some of the top-level tasks that you
Expand Down

0 comments on commit ffcf8cf

Please sign in to comment.