-
Notifications
You must be signed in to change notification settings - Fork 17
97 lines (84 loc) · 2.95 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Storybook
on:
workflow_dispatch:
push:
branches:
- master
- sandbox
paths:
- '.github/workflows/storybook.yml'
- 'frontend/ji_core/js/**'
- 'frontend/storybook/**'
- 'frontend/elements/**'
jobs:
prepare:
name: Prepare
runs-on: ubuntu-22.04
outputs:
branch: "${{ steps.branch.outputs.value }}"
steps:
- name: Get branch from ref
id: branch
run: echo "value=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
- name: Ensure valid branch
if: false == contains(fromJson('["master", "sandbox"]'), steps.branch.outputs.value)
run: |
echo "::error ${{ steps.branch.outputs.value }} cannot be deployed"
exit 1
bundle:
needs: [prepare]
name: "[${{ needs.prepare.outputs.branch }}] Bundle"
runs-on: ubuntu-latest
steps:
- name: "Set environment"
env:
BRANCH: ${{ needs.prepare.outputs.branch }}
run: |
if [[ ${BRANCH} == 'master' ]]; then
echo "ENVIRONMENT=release" >> $GITHUB_ENV
echo "PROJECT=ji-cloud" >> $GITHUB_ENV
echo "HOSTING=ji-cloud-storybook" >> $GITHUB_ENV
elif [[ ${BRANCH} == 'sandbox' ]]; then
echo "ENVIRONMENT=sandbox" >> $GITHUB_ENV
echo "PROJECT=ji-cloud-developer-sandbox" >> $GITHUB_ENV
echo "HOSTING=ji-cloud-sandbox-storybook" >> $GITHUB_ENV
fi
- uses: actions/checkout@v3
- name: Extract label
shell: bash
run: echo "value=\"[${{needs.prepare.outputs.branch}} - storybook]\"" >> $GITHUB_OUTPUT
id: extract_label
- name: install node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: install build utils deps
run: npm install
working-directory: "./frontend/build-utils"
- name: install element deps
run: npm install
working-directory: "./frontend/elements"
env:
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
- name: test elements
run: npm run test
working-directory: "./frontend/elements"
env:
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
- name: install npm deps
run: npm install
working-directory: "./frontend/storybook"
env:
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
- name: build
run: npm run storybook:build:${{ env.ENVIRONMENT }}
working-directory: "./frontend/storybook"
env:
LOCAL_CDN_FRONTEND_DIR: ${{ github.workspace }}/frontend
FONTAWESOME_NPM_AUTH_TOKEN: ${{ secrets.FONTAWESOME_NPM_AUTH_TOKEN }}
- name: deploy to firebase
uses: w9jds/[email protected]
with:
args: deploy --project ${{ env.PROJECT }} --only hosting:${{ env.HOSTING }}
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}