diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 51172c1..e235461 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -4,6 +4,9 @@ on: pull_request: branches: - main + push: + branches: + - main concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -63,7 +66,48 @@ jobs: - if: ${{ steps.cache-build.outputs.cache-hit != 'true' }} name: Build UI + run: yarn build + + storybook-check: + name: Verify Storybook + runs-on: ubuntu-latest + needs: ui-checks + + steps: + - uses: actions/checkout@v4 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Cache node modules + uses: actions/cache@v4 + id: cache-npm-storybook + with: + path: | + node_modules + ~/.npm + key: ${{ runner.os }}-storybook-modules-${{ hashFiles('yarn.lock') }} + restore-keys: | + ${{ runner.os }}-storybook-modules- + ${{ runner.os }}- + + - if: ${{ steps.cache-npm-storybook.outputs.cache-hit != 'true' }} + name: Install dependencies for Storybook + working-directory: storybook + run: npm install + + - name: Build Storybook + working-directory: storybook + run: npm run build-storybook + + - name: Verify Storybook Build run: | - export dateNow=$(date +"%Y-%m-%dT%H:%M") - echo "export const update = '$dateNow'" > update.ts - yarn build + if [ ! -d "storybook/storybook-static" ]; then + echo "Storybook build failed: directory not found." + exit 1 + else + echo "Storybook build successful." + fi diff --git a/.github/workflows/storybook.yml b/.github/workflows/storybook.yml new file mode 100644 index 0000000..5449fa4 --- /dev/null +++ b/.github/workflows/storybook.yml @@ -0,0 +1,36 @@ +name: Deploy Storybook + +on: + pull_request: + branches: + - main +# paths: +# - 'storybook/**' + +jobs: + build-storybook: + runs-on: ubuntu-latest + name: Build and Deploy Storybook + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install dependencies for Storybook + working-directory: storybook + run: npm install + + - name: Build Storybook + working-directory: storybook + run: npm run build-storybook + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: storybook/storybook-static diff --git a/storybook/package.json b/storybook/package.json index 8309a7c..ec68cf5 100644 --- a/storybook/package.json +++ b/storybook/package.json @@ -3,7 +3,6 @@ "version": "1.0.0", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", "storybook": "storybook dev -p 6006", "build-storybook": "storybook build" },