✨(ats-presentation) add content container components #126
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Storybook Pages | |
| on: | |
| push: | |
| branches: ["main"] | |
| paths: | |
| - "src/web/**" | |
| - ".github/workflows/storybook_pages.yml" | |
| - ".github/actions/**" | |
| pull_request: | |
| branches: ["main"] | |
| types: [opened, synchronize, reopened, labeled, closed] | |
| paths: | |
| - "src/web/**" | |
| - ".github/workflows/storybook_pages.yml" | |
| - ".github/actions/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: storybook-pages-${{ github.event_name }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy-stable: | |
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./src/web | |
| env: | |
| STORYBOOK_BASE_URL: /${{ github.event.repository.name }}/storybook/ | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: ./.github/actions/setup-pnpm-node | |
| with: | |
| lock-file-path: src/web/pnpm-lock.yaml | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm --filter csplab-frontend build-storybook | |
| - uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: gh-pages | |
| folder: src/web/presentation/frontend/storybook-static | |
| target-folder: storybook | |
| force: false | |
| deploy-preview: | |
| if: github.event_name == 'pull_request' && github.event.action != 'closed' && contains(github.event.pull_request.labels.*.name, 'storybook') | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./src/web | |
| env: | |
| STORYBOOK_BASE_URL: /${{ github.event.repository.name }}/storybook/pr-${{ github.event.number }}/ | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: ./.github/actions/setup-pnpm-node | |
| with: | |
| lock-file-path: src/web/pnpm-lock.yaml | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm --filter csplab-frontend build-storybook | |
| - uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: gh-pages | |
| folder: src/web/presentation/frontend/storybook-static | |
| target-folder: storybook/pr-${{ github.event.number }} | |
| force: false | |
| - uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const url = `https://${context.repo.owner}.github.io/${context.repo.repo}/storybook/pr-${context.issue.number}/` | |
| const marker = '<!-- storybook-preview -->' | |
| const body = `${marker}\n📖 Storybook de prévisualisation : ${url}` | |
| const comments = await github.paginate(github.rest.issues.listComments, { | |
| ...context.repo, | |
| issue_number: context.issue.number, | |
| }) | |
| const previous = comments.find(comment => comment.body.includes(marker)) | |
| if (previous) { | |
| await github.rest.issues.updateComment({ ...context.repo, comment_id: previous.id, body }) | |
| } else { | |
| await github.rest.issues.createComment({ ...context.repo, issue_number: context.issue.number, body }) | |
| } | |
| cleanup-preview: | |
| if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: gh-pages | |
| - name: Remove preview folder | |
| run: | | |
| git rm -rf --ignore-unmatch "storybook/pr-${{ github.event.number }}" | |
| git diff --cached --quiet && exit 0 | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git commit -m "chore: remove Storybook preview for PR #${{ github.event.number }}" | |
| git push |