-
Notifications
You must be signed in to change notification settings - Fork 152
64 lines (52 loc) · 2 KB
/
storybook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Storybook
on:
push:
branches:
- master
pull_request:
branches:
- "**"
env: # Set environment variables for every job and step in this workflow
CLICOLOR: "1" # Enable colors for *NIX commands
PY_COLORS: "1" # Enable colors for Python-based utilities
FORCE_COLOR: "1" # Force colors in the terminal
STREAMLINE_SECRET: ${{ secrets.STREAMLINE_SECRET }}
STREAMLINE_FAMILIES: ${{ secrets.STREAMLINE_FAMILIES }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Node
uses: ./.github/actions/node
- name: Compile design tokens
run: yarn tokens build
- name: Build tailwind
run: yarn tailwind-preset build
- name: Build Storybook
run: yarn components build:storybook
# TODO: find an alternative to using "if" statements for so many steps
- name: Get BRANCH_URL
# do not run on master branch
if: github.ref != 'refs/heads/master'
env:
BRANCH_NAME: ${{ github.head_ref }}
run: echo "BRANCH_URL=$(sed -e 's/[^a-zA-Z0-9]/-/g' <<< ${BRANCH_NAME})" >> $GITHUB_ENV
- name: Get DOMAIN
if: github.ref != 'refs/heads/master'
run: echo "DOMAIN=https://orbit-mainframev-${BRANCH_URL}.surge.sh" >> $GITHUB_ENV
- name: Deploy to staging
if: github.ref != 'refs/heads/master'
# we're adding to the domain name the username of the current owner of SURGE_TOKEN
run: |
yarn components deploy:surge ${DOMAIN} --token ${{ secrets.SURGE_TOKEN }}
yarn components deploy:updateURL --pr=${PR_NUMBER} --lastUrl=${DOMAIN} --token=${{ secrets.OCTO_TOKEN }} --urlName=Storybook
env:
PR_NUMBER: ${{ github.event.number }}
- name: Deploy to production
# run on master branch
if: github.ref == 'refs/heads/master'
run: yarn components deploy:storybook --ci
env:
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}