-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
99 lines (86 loc) · 2.94 KB
/
deploy-docs.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
name: "📘 Deploy docs"
on:
workflow_dispatch:
inputs:
runtime:
type: choice
description: JS runtime
default: "bun"
options:
- "bun"
- "npm"
workflow_call:
inputs:
daisyuiversion:
type: string
push:
branches:
- master
paths:
- "src/docs/**"
- "CHANGELOG.md"
jobs:
deploy-docs:
timeout-minutes: 10
runs-on: ubuntu-latest
env:
runtime: ${{ inputs.runtime || 'bun'}}
LEMONSQUEEZY_API_KEY: ${{ secrets.LEMONSQUEEZY_API_KEY }}
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }}
GH_API_KEY: ${{ secrets.GH_API_KEY }}
daisyuiversion: ${{ inputs.daisyuiversion || 'latest' }}
if: |
github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_call' ||
github.event_name == 'push' ||
github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
clean: false
- name: Setup Node
if: env.runtime == 'npm'
uses: actions/setup-node@v4
with:
node-version: "21.1.0"
registry-url: https://registry.npmjs.org
- name: Setup bun
if: env.runtime == 'bun'
uses: oven-sh/setup-bun@v1.2.2
- name: Install package dependencies
run: ${{ env.runtime }} install
- name: Build package
run: ${{ env.runtime }} run build:skipfullcss
- name: Install docs dependencies
run: cd src/docs && ${{ env.runtime }} install
- name: Install daisyUI ${{env.daisyuiversion}} version if production
if: github.repository == 'saadeghi/daisyui'
run: cd src/docs && ${{ env.runtime }} i daisyui@${{env.daisyuiversion}}
- name: Install daisyUI newest tag if staging
if: github.repository == 'daisyui/daisyui.github.io'
run: cd src/docs && ${{ env.runtime }} i daisyui@$([[ $(npm view daisyui version) > $(npm view daisyui dist-tags.alpha) ]] && echo "${{env.daisyuiversion}}" || echo "alpha")
- name: Set daisyUI version in env file if staging
if: github.repository == 'daisyui/daisyui.github.io'
run: |
echo 'VITE_DAISYUI_VERSION=ALPHA' > src/docs/.env
- name: Add robots.txt if not main repo
if: github.repository != 'saadeghi/daisyui'
run: |
echo 'User-agent: *
Disallow: /' > src/docs/static/robots.txt
- name: Build docs
run: |
cd src/docs
if [ -z "${{inputs.daisyuiversion}}" ]; then
${{ env.runtime }} run build
else
VITE_DAISYUI_VERSION=${{inputs.daisyuiversion}} ${{ env.runtime }} run build
fi
- name: Deploy docs to github pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./src/docs/build
cname: ${{ secrets.CNAME }}