From ba1a9a10563f1d8e51a1d2570fdef1f5f27c9b40 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Wed, 6 Nov 2024 11:32:15 -0800 Subject: [PATCH 1/2] Consolidate docsite/storybook CI/CD workflows --- .github/workflows/deploy-docsite.yml | 19 +++++++++++-- .github/workflows/test-build-docsite.yml | 36 ------------------------ 2 files changed, 16 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/test-build-docsite.yml diff --git a/.github/workflows/deploy-docsite.yml b/.github/workflows/deploy-docsite.yml index d2a5237be3..c91e6c0816 100644 --- a/.github/workflows/deploy-docsite.yml +++ b/.github/workflows/deploy-docsite.yml @@ -1,4 +1,6 @@ -name: Deploy Docsite and Storybook +name: Docsite and Storybook CI/CD + +run-name: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'Build and Deploy' || 'Test Build' }} Docsite and Storybook env: NODE_VERSION: 20 @@ -7,9 +9,16 @@ on: push: branches: - main - # Review gh actions docs if you want to further define triggers, paths, etc - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on workflow_dispatch: + # Also run any time a PR is opened targeting the docs or storybook resources + pull_request: + branches: + - main + paths: + - "docs/**" + - "storybook/**" + - "**/*.story.*" + - "**/*.stories.*" jobs: build: @@ -37,11 +46,15 @@ jobs: - name: Copy Storybook to docs run: cp -r storybook-static docs/build/storybook && cp -r assets docs/build/assets/assets - name: Upload Build Artifact + # Only upload the build artifact when pushed to the main branch + if: github.event_name == 'push' && github.ref == 'refs/heads/main' uses: actions/upload-pages-artifact@v3 with: path: docs/build deploy: name: Deploy to GitHub Pages + # Only deploy when pushed to the main branch + if: github.event_name == 'push' && github.ref == 'refs/heads/main' needs: build # Grant GITHUB_TOKEN the permissions required to make a Pages deployment permissions: diff --git a/.github/workflows/test-build-docsite.yml b/.github/workflows/test-build-docsite.yml deleted file mode 100644 index 32f0e17d3e..0000000000 --- a/.github/workflows/test-build-docsite.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Test Docsite and Storybook Build - -env: - NODE_VERSION: 20 - -on: - pull_request: - branches: - - main - # Review gh actions docs if you want to further define triggers, paths, etc - # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on - paths: - - "docs/**" - - "storybook/**" - - "**/*.story.*" - - "**/*.stories.*" -jobs: - test-deploy: - name: Test deployment - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: actions/setup-node@v4 - with: - node-version: ${{env.NODE_VERSION}} - - name: Install yarn - run: | - corepack enable - yarn install - - name: Test build website - run: yarn build - working-directory: docs/ - - name: Test build storybook - run: yarn build-storybook From e6f44c0e134a15ded45ab7c6a263418ed42e8744 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Wed, 6 Nov 2024 11:33:24 -0800 Subject: [PATCH 2/2] add trigger path for self --- .github/workflows/deploy-docsite.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-docsite.yml b/.github/workflows/deploy-docsite.yml index c91e6c0816..72c6973c08 100644 --- a/.github/workflows/deploy-docsite.yml +++ b/.github/workflows/deploy-docsite.yml @@ -19,6 +19,7 @@ on: - "storybook/**" - "**/*.story.*" - "**/*.stories.*" + - ".github/workflows/deploy-docsite.yml" jobs: build: