-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
90 lines (78 loc) · 2.53 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
name: "📘 Deploy docs"
on:
workflow_dispatch:
inputs:
runtime:
type: choice
description: JS runtime
default: "bun"
options:
- "bun"
- "npm"
npm-tag:
type: choice
description: Version of daisyUI to install
default: "latest"
options:
- "latest"
- "alpha"
workflow_call:
push:
branches:
- master
paths:
- "src/docs/**"
workflow_run:
workflows:
- "🎉 Release new version"
types:
- completed
jobs:
deploy-docs:
runs-on: ubuntu-latest
env:
runtime: ${{ github.event.inputs.runtime || 'bun'}}
npm-tag: ${{ github.event.inputs.npm-tag || 'latest'}}
LEMONSQUEEZY_API_KEY: ${{ secrets.LEMONSQUEEZY_API_KEY }}
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@v3
- name: Setup Node
if: env.runtime == 'npm'
uses: actions/setup-node@v3
with:
node-version: "lts/*"
registry-url: https://registry.npmjs.org
- name: Setup bun
if: env.runtime == 'bun'
uses: oven-sh/setup-bun@v1
- 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 fixed tag if production
if: github.repository == 'saadeghi/daisyui'
run: cd src/docs && ${{ env.runtime }} i daisyui@${{ env.npm-tag }}
- name: Install daisyUI newest version 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 "latest" || echo "alpha")
- name: Add robots.txt if staging repo
if: github.repository != 'saadeghi/daisyui'
run: |
echo 'User-agent: *
Disallow: /' > src/docs/static/robots.txt
- name: Build docs
run: cd src/docs && ${{ env.runtime }} run build
- name: Deploy docs to github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./src/docs/build
cname: ${{ secrets.CNAME }}