diff --git a/.circleci/config.yml b/.circleci/config.yml index 2217f91..79c46de 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -128,6 +128,26 @@ jobs: name: Run test suites over all workspaces command: yarn test + # ---- Deploy ---- + publish-storybook: + docker: + - image: cimg/node:16.18 + working_directory: ~/cunningham + steps: + - add_ssh_keys: + fingerprints: + - "5e:86:38:27:26:f2:1b:7f:4b:36:99:38:63:d9:2b:75" + - *checkout_cunningham + - *restore_node_modules + - attach_workspace: + at: ~/cunningham + - run: + name: Publish storybook + command: | + cd packages/react + git config user.email "funmoocbot@users.noreply.github.com" + git config user.name "FUN MOOC bot" + yarn deploy-storybook workflows: version: 2.1 @@ -177,3 +197,10 @@ workflows: requires: - build - lint + - publish-storybook: + filters: + branches: + only: + - main + requires: + - test \ No newline at end of file diff --git a/packages/react/.storybook/main.cjs b/packages/react/.storybook/main.cjs index 58eb6cc..1b1c7a1 100644 --- a/packages/react/.storybook/main.cjs +++ b/packages/react/.storybook/main.cjs @@ -1,33 +1,32 @@ const viteTsconfig = require('vite-tsconfig-paths'); const tsconfigPaths = viteTsconfig.default; - const { mergeConfig } = require('vite'); module.exports = { - "stories": [ - "../src/**/*.stories.mdx", - "../src/**/*.stories.@(js|jsx|ts|tsx)" + 'stories': [ + '../src/**/*.stories.mdx', + '../src/**/*.stories.@(js|jsx|ts|tsx)', ], - "addons": [ - "@storybook/addon-links", - "@storybook/addon-essentials", - "@storybook/addon-interactions", - '@storybook/preset-scss' + 'addons': [ + '@storybook/addon-links', + '@storybook/addon-essentials', + '@storybook/addon-interactions', ], - "framework": "@storybook/react", - "core": { - "builder": "@storybook/builder-vite" + 'framework': '@storybook/react', + 'core': { + 'builder': '@storybook/builder-vite', }, staticDirs: [ - 'dist', - '../src' + '../src', ], - "features": { - "storyStoreV7": true + 'features': { + 'storyStoreV7': true, }, async viteFinal(config) { - return mergeConfig(config, { + const finalConfig = mergeConfig(config, { plugins: [tsconfigPaths()], }); + finalConfig.base = 'https://openfun.github.io/cunningham'; + return finalConfig; }, -} \ No newline at end of file +}; \ No newline at end of file diff --git a/packages/react/.storybook/preview-head.html b/packages/react/.storybook/preview-head.html index 79c8a0d..037204a 100644 --- a/packages/react/.storybook/preview-head.html +++ b/packages/react/.storybook/preview-head.html @@ -1,4 +1,3 @@ -