From 33cb6da6f7c26e98b061558d955b5b050171eed2 Mon Sep 17 00:00:00 2001 From: Michael Taranto Date: Thu, 7 Nov 2024 10:43:43 +1100 Subject: [PATCH] Deploy site on snapshot publish --- .github/workflows/preview-site.yml | 7 ++++--- .github/workflows/snapshot.yml | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview-site.yml b/.github/workflows/preview-site.yml index c71d8951139..2fc7cfea516 100644 --- a/.github/workflows/preview-site.yml +++ b/.github/workflows/preview-site.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest env: CI: true + SITE_PREVIEW_PATH: preview/${{ github.sha }} steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -37,7 +38,7 @@ jobs: - name: Build run: pnpm build:site env: - BASE_NAME: /braid-design-system/${{ github.ref_name }} + BASE_NAME: /braid-design-system/${{ env.SITE_PREVIEW_PATH }} BRANCH_NAME: ${{ github.ref_name }} HEAD_BRANCH_NAME: ${{ github.head_ref }} @@ -46,11 +47,11 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} folder: ./site/dist - target-folder: ${{ github.ref_name }} + target-folder: ${{ env.SITE_PREVIEW_PATH }} commit-message: Preview of `${{ github.ref_name }}` - name: Update PR status run: pnpm post-commit-status env: - BASE_NAME: /braid-design-system/${{ github.ref_name }} + BASE_NAME: /braid-design-system/${{ env.SITE_PREVIEW_PATH }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 12dfb5d7dcf..d59b60d7b01 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -8,6 +8,7 @@ jobs: runs-on: ubuntu-latest env: CI: true + SITE_PREVIEW_PATH: ${{ github.ref_name }} steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -35,3 +36,18 @@ jobs: env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Build + run: pnpm build:site + env: + BASE_NAME: /braid-design-system/${{ env.SITE_PREVIEW_PATH }} + BRANCH_NAME: ${{ github.ref_name }} + HEAD_BRANCH_NAME: ${{ github.head_ref }} + + - name: Deploy preview site + uses: JamesIves/github-pages-deploy-action@881db5376404c5c8d621010bcbec0310b58d5e29 # 4.6.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + folder: ./site/dist + target-folder: ${{ env.SITE_PREVIEW_PATH }} + commit-message: Preview of `${{ github.ref_name }}`