forked from equinor/design-system
-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (144 loc) · 4.81 KB
/
publish_lab.yaml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Publish lab-react
on:
workflow_dispatch:
inputs:
npm-tag:
description: 'Tag for npm package (next | latest)'
required: true
default: 'next'
storybook-slot:
description: 'Slot for Storybook (development | production | lab | test)'
required: false
default: 'lab'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
setup:
uses: equinor/design-system/.github/workflows/_setup.yml@develop
with:
cacheKey: ${{ github.sha }}
checkout_paths: packages/eds-core-react packages/eds-tokens packages/eds-icons packages/eds-lab-react packages/eds-utils
stage: ${{ github.event.inputs.storybook-slot }}
tag: ${{ github.event.inputs.npm-tag }}
packages:
name: Process packages
runs-on: ubuntu-latest
needs: [setup]
steps:
- name: Use "setup" cache
id: setup-cache
uses: actions/cache@v3
with:
path: |
./*
~/.pnpm-store
key: ${{ github.sha }}
- name: Use "dist" cache
id: dist-cache
uses: actions/cache@v3
with:
path: |
./*
~/.pnpm-store
key: ${{ github.sha }}-dist-${{ needs.setup.outputs.stage }}-lab
- name: Build packages
id: build-packages
run: node_modules/.bin/pnpm run build
- name: Build lab Storybook
id: build-storybook
run: node_modules/.bin/pnpm build:storybook:lab
- name: log-errors-to-slack
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
publish-utils-package:
name: Publish utils to npm
runs-on: ubuntu-latest
needs: [packages, setup]
steps:
- name: Use "dist" cache
id: dist-cache
uses: actions/cache@v3
with:
path: |
./*
~/.pnpm-store
key: ${{ github.sha }}-dist-${{ needs.setup.outputs.stage }}-lab
- name: Publish to npm
id: publish-to-npm
run: |
node_modules/.bin/pnpm config set '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }}
node_modules/.bin/pnpm --filter @equinor/eds-utils publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks
- name: log-errors-to-slack
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
publish-lab-package:
name: Publish lab to npm
runs-on: ubuntu-latest
needs: [publish-utils-package, setup]
steps:
- name: Use "dist" cache
id: dist-cache
uses: actions/cache@v3
with:
path: |
./*
~/.pnpm-store
key: ${{ github.sha }}-dist-${{ needs.setup.outputs.stage }}-lab
- name: Publish to npm
id: publish-to-npm
run: |
node_modules/.bin/pnpm config set '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }}
node_modules/.bin/pnpm --filter @equinor/eds-lab-react publish --access public --tag ${{ needs.setup.outputs.tag }} --no-git-checks
- name: log-errors-to-slack
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
# TODO: Delete when new storybook is being used
publish-old-storybook:
name: Publish Storybook
needs: [setup, packages]
uses: equinor/design-system/.github/workflows/_azure_docker.yml@develop
with:
stage: ${{ needs.setup.outputs.stage }}
cacheKey: ${{ github.sha }}-dist-${{ needs.setup.outputs.stage }}-lab
dockerfilePath: './packages/eds-lab-react/Dockerfile.storybook'
secrets:
REGISTRY_LOGIN_SERVER: ${{ secrets.REGISTRY_LOGIN_SERVER }}
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
publish-storybook:
needs: [setup, packages]
name: Build & Deploy Website
runs-on: ubuntu-latest
steps:
- name: Use cache with storybook files
id: use-cache-storybook
uses: actions/cache@v3
with:
path: |
./*
~/.pnpm-store
key: ${{ github.sha }}-dist-production-lab-storybook
- name: Deploy the website
id: deploy-website
uses: tibor19/static-website-deploy@v2
with:
enabled-static-website: 'true'
folder: 'packages/eds-lab-react/storybook-build'
public-access-policy: 'container'
connection-string: ${{ secrets.AZ_STORAGE_STORYBOOK_LAB_CONNECTION_STRING }}
- name: log-errors-to-slack
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()