Skip to content

Commit

Permalink
chore: fix urls in preview workflows (#2430)
Browse files Browse the repository at this point in the history
  • Loading branch information
mimarz authored Sep 17, 2024
1 parent 3451704 commit fdc61bd
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
File renamed without changes.
11 changes: 5 additions & 6 deletions .github/workflows/preview-storefront.yml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}
11 changes: 5 additions & 6 deletions .github/workflows/preview-storybook.yml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 }}
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/preview-theme.yml
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
${{ 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 }}`

0 comments on commit fdc61bd

Please sign in to comment.