diff --git a/.github/workflows/cleanup-preview-deployments.yml b/.github/workflows/preview-cleanup.yml similarity index 70% rename from .github/workflows/cleanup-preview-deployments.yml rename to .github/workflows/preview-cleanup.yml index fe15ca2786..2871f41a0f 100644 --- a/.github/workflows/cleanup-preview-deployments.yml +++ b/.github/workflows/preview-cleanup.yml @@ -5,10 +5,9 @@ on: env: VERCEL_TEAM: ${{ secrets.VERCEL_TEAM }} - VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID_STOREFRONT }} - STORYBOOK_URL: storybook-pr-${{ github.event.number }}.dev.designsystemet.no - STOREFRONT_URL: storefront-pr-${{ github.event.number }}.dev.designsystemet.no + STORYBOOK_URL: pr-${{ github.event.number }}.storybook.designsystemet.no + STOREFRONT_URL: pr-${{ github.event.number }}.designsystemet.no + THEME_URL: pr-${{ github.event.number }}.theme.designsystemet.no ALIASES: jobs: @@ -33,3 +32,7 @@ jobs: - name: Remove Storefront alias if it exists if: contains(env.ALIASES, env.STOREFRONT_URL) run: vercel alias rm --yes --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_TEAM }} ${{ env.STOREFRONT_URL }} + + - name: Remove Theme alias if it exists + if: contains(env.ALIASES, env.THEME_URL) + run: vercel alias rm --yes --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_TEAM }} ${{ env.THEME_URL }} diff --git a/.github/workflows/create-preview-comment.yml b/.github/workflows/preview-comment.yml similarity index 100% rename from .github/workflows/create-preview-comment.yml rename to .github/workflows/preview-comment.yml diff --git a/.github/workflows/preview-storefront.yml b/.github/workflows/preview-storefront.yml index cdfc3b2f64..7b5c346eb2 100644 --- a/.github/workflows/preview-storefront.yml +++ b/.github/workflows/preview-storefront.yml @@ -1,4 +1,4 @@ -name: Deploy Storefront PR +name: Deploy Storefront Preview env: VERCEL_TEAM: ${{ secrets.VERCEL_TEAM }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} @@ -42,7 +42,7 @@ jobs: run: echo "url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT - name: Set Vercel alias - run: vercel alias --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_TEAM }} set ${{ steps.deploy.outputs.url }} storefront-pr-${{ env.PR_NUMBER }}.dev.designsystemet.no + run: vercel alias --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_TEAM }} set ${{ steps.deploy.outputs.url }} pr-${{ env.PR_NUMBER }}.designsystemet.no - name: Find Preview Comment uses: peter-evans/find-comment@v2 @@ -60,14 +60,14 @@ jobs: id: regex-storybook with: text: ${{ steps.fc.outputs.comment-body }} - regex: '\[Storybook\]\((https:\/\/[^)]+)\) `[^`]+`' + regex: '\[Storybook\]\((https:\/\/[^)]+)\).*' - name: Find Theme deployment uses: actions-ecosystem/action-regex-match@v2 id: regex-theme with: text: ${{ steps.fc.outputs.comment-body }} - regex: '\[Theme\]\((https:\/\/[^)]+)\)' + regex: '\[Theme\]\((https:\/\/[^)]+)\).*' - name: Get current time in CEST uses: josStorer/get-current-time@v2 @@ -82,12 +82,11 @@ jobs: issue-number: ${{ env.PR_NUMBER }} comment-id: ${{ steps.fc.outputs.comment-id }} edit-mode: replace - reactions: rocket, eyes body: | **Preview deployments for this pull request:** ${{ steps.regex-storybook.outputs.match }} - [Storefront](https://storefront-pr-${{ env.PR_NUMBER }}.dev.designsystemet.no) `${{ steps.current-time.outputs.formattedTime }} (Norwegian time)` + [Storefront](https://pr-${{ env.PR_NUMBER }}.designsystemet.no) - `${{ steps.current-time.outputs.formattedTime }}` ${{ steps.regex-theme.outputs.match }} diff --git a/.github/workflows/preview-storybook.yml b/.github/workflows/preview-storybook.yml index 56659066fa..a29c6dbf8a 100644 --- a/.github/workflows/preview-storybook.yml +++ b/.github/workflows/preview-storybook.yml @@ -1,4 +1,4 @@ -name: Deploy Storybook PR +name: Deploy Storybook Preview env: VERCEL_TEAM: ${{ secrets.VERCEL_TEAM }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} @@ -44,7 +44,7 @@ jobs: run: echo "url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})" >> $GITHUB_OUTPUT - name: Set Vercel alias - run: vercel alias --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_TEAM }} set ${{ steps.deploy.outputs.url }} storybook-pr-${{ env.PR_NUMBER }}.dev.designsystemet.no + run: vercel alias --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_TEAM }} set ${{ steps.deploy.outputs.url }} pr-${{ env.PR_NUMBER }}.storybook.designsystemet.no - name: Find Preview Comment uses: peter-evans/find-comment@v2 @@ -62,14 +62,14 @@ jobs: id: regex-storefront with: text: ${{ steps.fc.outputs.comment-body }} - regex: '\[Storefront\]\((https:\/\/[^)]+)\) `[^`]+`' + regex: '\[Storefront\]\((https:\/\/[^)]+)\).*' - name: Find Theme deployment uses: actions-ecosystem/action-regex-match@v2 id: regex-theme with: text: ${{ steps.fc.outputs.comment-body }} - regex: '\[Theme\]\((https:\/\/[^)]+)\)' + regex: '\[Theme\]\((https:\/\/[^)]+)\).*' - name: Get current time in CEST uses: josStorer/get-current-time@v2 @@ -84,11 +84,10 @@ jobs: issue-number: ${{ env.PR_NUMBER }} comment-id: ${{ steps.fc.outputs.comment-id }} edit-mode: replace - reactions: rocket, eyes body: | **Preview deployments for this pull request:** - [Storybook](https://storybook-pr-${{ env.PR_NUMBER }}.dev.designsystemet.no) `${{ steps.current-time.outputs.formattedTime }} (Norwegian time)` + [Storybook](https://pr-${{ env.PR_NUMBER }}.storybook.designsystemet.no) - `${{ steps.current-time.outputs.formattedTime }}` ${{ steps.regex-storefront.outputs.match }} diff --git a/.github/workflows/preview-theme.yml b/.github/workflows/preview-theme.yml index ed0158f8be..16473e3315 100644 --- a/.github/workflows/preview-theme.yml +++ b/.github/workflows/preview-theme.yml @@ -1,4 +1,4 @@ -name: Deploy Theme PR +name: Deploy Theme Preview env: VERCEL_TEAM: ${{ secrets.VERCEL_TEAM }} VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} @@ -60,14 +60,14 @@ jobs: id: regex-storybook with: text: ${{ steps.fc.outputs.comment-body }} - regex: '\[Storybook\]\((https:\/\/[^)]+)\) `[^`]+`' + regex: '\[Storybook\]\((https:\/\/[^)]+)\).*' - name: Find Storefront deployment uses: actions-ecosystem/action-regex-match@v2 id: regex-storefront with: text: ${{ steps.fc.outputs.comment-body }} - regex: '\[Storefront\]\((https:\/\/[^)]+)\) `[^`]+`' + regex: '\[Storefront\]\((https:\/\/[^)]+)\).*' - name: Get current time in CEST uses: josStorer/get-current-time@v2 @@ -82,7 +82,6 @@ jobs: issue-number: ${{ env.PR_NUMBER }} comment-id: ${{ steps.fc.outputs.comment-id }} edit-mode: replace - reactions: rocket, eyes body: | **Preview deployments for this pull request:** @@ -90,4 +89,4 @@ jobs: ${{ steps.regex-storefront.outputs.match }} - [Theme](https://pr-${{ env.PR_NUMBER }}.theme.designsystemet.no) `${{ steps.current-time.outputs.formattedTime }} (Norwegian time)` + [Theme](https://pr-${{ env.PR_NUMBER }}.theme.designsystemet.no) - `${{ steps.current-time.outputs.formattedTime }}`