Skip to content

Commit bb26d52

Browse files
pomfridaeddiman
authored andcommitted
fix: only run CDN purge for production storybook (#4321)
1 parent 14e8284 commit bb26d52

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

.github/workflows/_purge_cdn.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,17 @@ on:
88
endpoint:
99
type: string
1010
default: artefacts
11-
# Because of limitations in how to set environment context when calling reusable workflows,
12-
# we are using ENV variables directly in this one. Not pretty, but it works.
13-
env:
14-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
15-
AZURE_CDN_PROFILE_NAME: ${{ vars.AZURE_CDN_PROFILE_NAME }}
16-
AZURE_CDN_ENDPOINT_NAME: ${{ vars.AZURE_CDN_ENDPOINT_NAME }}
17-
AZURE_STORYBOOK_ENDPOINT_NAME: ${{ vars.AZURE_STORYBOOK_ENDPOINT_NAME }}
18-
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
1911
jobs:
2012
purge:
2113
name: Purge the cdn to refresh cache
2214
runs-on: ubuntu-latest
2315
environment: ${{ inputs.environment }}
16+
env:
17+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
18+
AZURE_CDN_PROFILE_NAME: ${{ vars.AZURE_CDN_PROFILE_NAME }}
19+
AZURE_CDN_ENDPOINT_NAME: ${{ vars.AZURE_CDN_ENDPOINT_NAME }}
20+
AZURE_STORYBOOK_ENDPOINT_NAME: ${{ vars.AZURE_STORYBOOK_ENDPOINT_NAME }}
21+
AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }}
2422
steps:
2523
- name: Az CLI login 🔑 # Using federated credential
2624
uses: azure/login@v1

.github/workflows/publish_storybook.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77
required: false
88
type: choice
99
options:
10-
- development
1110
- production
12-
default: 'development'
11+
- development
12+
default: 'production'
1313
push:
1414
branches:
1515
- main
@@ -177,9 +177,12 @@ jobs:
177177

178178
purge-cdn:
179179
needs: [publish-storybook]
180+
# Only purge CDN for production. On push to main, environment is undefined,
181+
# which correctly skips this job since dev storybook has no CDN.
182+
if: github.event.inputs.environment == 'production'
180183
name: Purge cdn
181184
uses: ./.github/workflows/_purge_cdn.yaml
182185
secrets: inherit
183186
with:
184-
environment: ${{ github.event.inputs.environment || 'development' }}
187+
environment: production
185188
endpoint: storybook

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ While the design system itself lives in [Figma][], this repository contains impl
66

77
## Quick links
88

9-
- [Storybook](https://storybook.eds.equinor.com/)
9+
- [Storybook (prod)](https://storybook.eds.equinor.com/)
10+
- [Storybook (dev)](https://s478stedsstorybookdev.z16.web.core.windows.net/) – latest from `main`
1011
- [Figma](https://www.figma.com/files/682286909510540417/team/590517879490131675/EDS---Equinor-Design-System?fuid=677437722215124736)
1112
- [Storefront](https://eds.equinor.com)
1213
- [Slack](https://equinor.slack.com/archives/CJT20H1B9)

0 commit comments

Comments
 (0)