Skip to content

Commit 1668f8c

Browse files
authored
ci: deploy storybook only when publishing package (#878)
1 parent 592729a commit 1668f8c

File tree

1 file changed

+46
-45
lines changed

1 file changed

+46
-45
lines changed
Lines changed: 46 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,58 @@
11
name: Deploy Storybook to Pages
22

33
on:
4-
push:
5-
branches: ["main"]
6-
workflow_dispatch:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
78

89
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
910
permissions:
10-
contents: read
11-
pages: write
12-
id-token: write
11+
contents: read
12+
pages: write
13+
id-token: write
1314

1415
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1516
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
1617
concurrency:
17-
group: "pages"
18-
cancel-in-progress: false
18+
group: 'pages'
19+
cancel-in-progress: false
1920

2021
jobs:
21-
# Single deploy job since we're just deploying
22-
deploy:
23-
environment:
24-
name: github-pages
25-
url: ${{ steps.deployment.outputs.page_url }}
26-
runs-on: ubuntu-latest
27-
steps:
28-
- name: Checkout
29-
uses: actions/checkout@v4
30-
31-
- name: Read Node.js version from '.nvmrc'
32-
id: nvmrc
33-
run: |
34-
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
35-
36-
- name: Setup Node.js
37-
uses: actions/setup-node@v1
38-
with:
39-
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
40-
41-
- name: Install dependencies
42-
run: npm ci
43-
44-
- name: Build storybook
45-
run: npm run build:storybook
46-
47-
- name: Setup Pages
48-
uses: actions/configure-pages@v3
49-
50-
- name: Upload artifact
51-
uses: actions/upload-pages-artifact@v1
52-
with:
53-
path: './docs'
54-
55-
- name: Deploy to GitHub Pages
56-
id: deployment
57-
uses: actions/deploy-pages@v2
22+
# Single deploy job since we're just deploying
23+
deploy:
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Read Node.js version from '.nvmrc'
33+
id: nvmrc
34+
run: |
35+
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
36+
37+
- name: Setup Node.js
38+
uses: actions/setup-node@v1
39+
with:
40+
node-version: ${{ steps.nvmrc.outputs.NODE_VERSION }}
41+
42+
- name: Install dependencies
43+
run: npm ci
44+
45+
- name: Build storybook
46+
run: npm run build:storybook
47+
48+
- name: Setup Pages
49+
uses: actions/configure-pages@v3
50+
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v1
53+
with:
54+
path: './docs'
55+
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v2

0 commit comments

Comments
 (0)