-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
135 lines (108 loc) · 4.27 KB
/
generate-sandboxes.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
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
name: Generate and publish sandboxes
on:
schedule:
- cron: "2 2 */1 * *"
workflow_dispatch:
# To test fixes on push rather than wait for the scheduling, do the following:
# 1. Uncomment the lines below and add your branch.
# push:
# branches:
# - <your-branch-name>
# 2. Change the "ref" value to <your-branch-name> in the actions/checkout step below.
# 3. Comment out the whole "generate-main" job starting at line 77
# 4. 👉 DON'T FORGET TO UNDO THE STEPS BEFORE YOU MERGE YOUR CHANGES!
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: "false"
CLEANUP_SANDBOX_NODE_MODULES: "true"
defaults:
run:
working-directory: ./code
jobs:
generate-next:
name: Generate to next
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: next
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.1
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Setup git user
run: |
git config --global user.name "storybook-bot"
git config --global user.email "32066757+storybook-bot@users.noreply.github.com"
- name: Install dependencies
working-directory: ./scripts
run: node --experimental-modules ./check-dependencies.js
- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link
- name: Publish to local registry
run: yarn local-registry --publish
- name: Run local registry
run: yarn local-registry --open &
- name: Wait for registry
run: yarn wait-on tcp:127.0.0.1:6001
- name: Generate
id: generate
run: yarn generate-sandboxes --local-registry
- name: Publish
# publish sandboxes even if the generation fails, as some sandboxes might have been generated successfully
if: ${{ !cancelled() }}
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT }}@github.com/storybookjs/sandboxes.git --push --branch=next
- name: Report failure to Discord
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: |
The generation of some or all sandboxes on the **next** branch has failed.
[See the job summary for details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
generate-main:
name: Generate to main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: oven-sh/setup-bun@v1
with:
bun-version: 1.1.1
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Setup git user
run: |
git config --global user.name "storybook-bot"
git config --global user.email "32066757+storybook-bot@users.noreply.github.com"
- name: Install dependencies
working-directory: ./scripts
run: node --experimental-modules ./check-dependencies.js
- name: Compile Storybook libraries
run: yarn task --task compile --start-from=auto --no-link
- name: Publish to local registry
run: yarn local-registry --publish
- name: Run local registry
run: yarn local-registry --open &
- name: Wait for registry
run: yarn wait-on tcp:127.0.0.1:6001
- name: Generate
id: generate
run: yarn generate-sandboxes --local-registry
- name: Publish
# publish sandboxes even if the generation fails, as some sandboxes might have been generated successfully
if: ${{ !cancelled() }}
run: yarn publish-sandboxes --remote=https://storybook-bot:${{ secrets.PAT_STORYBOOK_BOT }}@github.com/storybookjs/sandboxes.git --push --branch=main
- name: Report failure to Discord
if: failure()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_MONITORING_URL }}
uses: Ilshidur/action-discord@master
with:
args: |
The generation of some or all sandboxes on the **main** branch has failed.
[See the job summary for details](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})