From 7451f16e03c136a58d3d279b491378e65455cea7 Mon Sep 17 00:00:00 2001 From: Meghea Iulian Date: Thu, 21 Mar 2024 07:57:28 +0200 Subject: [PATCH 1/4] feat: preview prs --- .github/workflows/preview.yml | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 00000000..c92ebcbc --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,36 @@ +name: Deploy PR previews +concurrency: preview-${{ github.ref }} +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed +jobs: + deploy-preview: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install + run: npm ci + + - name: Build + run: npm run build --if-present + + - uses: rossjrw/pr-preview-action@v1 + with: + source-dir: . + preview-branch: gh-pages + umbrella-dir: pr-preview + action: auto From 6c9f866477fa538b47ac17dc0902ed3a3881d3a5 Mon Sep 17 00:00:00 2001 From: Meghea Iulian Date: Thu, 21 Mar 2024 08:07:56 +0200 Subject: [PATCH 2/4] feat: deploy storybook-static --- .eslintignore | 1 + .github/workflows/preview.yml | 10 +++++++++- .gitignore | 1 + stories/cosmoz-autocomplete.stories.js | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.eslintignore b/.eslintignore index d5c36bb1..42dc3b50 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ coverage/ dist/ +storybook-static/ __snapshots__/ diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index c92ebcbc..568cbef4 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -28,9 +28,17 @@ jobs: - name: Build run: npm run build --if-present + - name: Fix imports + run: | + [ -d "stories" ] && sed -i 's/..\/src/..\/dist/g' stories/*.stories.js || true + [ -d "demo" ] && sed -i 's/..\/src/..\/dist/g' demo/*.js || true + + - name: Build storybook + run: npm run storybook:build + - uses: rossjrw/pr-preview-action@v1 with: - source-dir: . + source-dir: ./storybook-static preview-branch: gh-pages umbrella-dir: pr-preview action: auto diff --git a/.gitignore b/.gitignore index f34e3e4b..34d51dfa 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ coverage/ .eslintcache .DS_Store dist/ +storybook-static/ diff --git a/stories/cosmoz-autocomplete.stories.js b/stories/cosmoz-autocomplete.stories.js index d44e51c7..48fe98aa 100644 --- a/stories/cosmoz-autocomplete.stories.js +++ b/stories/cosmoz-autocomplete.stories.js @@ -1,5 +1,5 @@ import { html } from 'lit-html'; -import '../src/autocomplete/'; +import '../src/autocomplete/index.ts'; import { colors } from './data'; export default { From 28be6e01873a1ec5fddde74190e85372db24eeda Mon Sep 17 00:00:00 2001 From: Meghea Iulian Date: Thu, 21 Mar 2024 08:50:53 +0200 Subject: [PATCH 3/4] chore: update import --- stories/cosmoz-autocomplete.stories.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stories/cosmoz-autocomplete.stories.js b/stories/cosmoz-autocomplete.stories.js index 48fe98aa..3f4688aa 100644 --- a/stories/cosmoz-autocomplete.stories.js +++ b/stories/cosmoz-autocomplete.stories.js @@ -1,5 +1,5 @@ import { html } from 'lit-html'; -import '../src/autocomplete/index.ts'; +import '../src/autocomplete'; import { colors } from './data'; export default { From fbaddc2113101f9d6d81cfef6e0850724daa6433 Mon Sep 17 00:00:00 2001 From: Meghea Iulian Date: Thu, 21 Mar 2024 09:02:44 +0200 Subject: [PATCH 4/4] feat: update preview --- .github/workflows/preview.yml | 37 +++-------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 568cbef4..cffee5af 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -8,37 +8,6 @@ on: - synchronize - closed jobs: - deploy-preview: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'npm' - - - name: Install - run: npm ci - - - name: Build - run: npm run build --if-present - - - name: Fix imports - run: | - [ -d "stories" ] && sed -i 's/..\/src/..\/dist/g' stories/*.stories.js || true - [ -d "demo" ] && sed -i 's/..\/src/..\/dist/g' demo/*.js || true - - - name: Build storybook - run: npm run storybook:build - - - uses: rossjrw/pr-preview-action@v1 - with: - source-dir: ./storybook-static - preview-branch: gh-pages - umbrella-dir: pr-preview - action: auto + storybook: + uses: Neovici/cfg/.github/workflows/preview.yml@master + secrets: inherit