Skip to content

📘 Deploy docs

📘 Deploy docs #204

Workflow file for this run

name: "📘 Deploy docs"
on:
workflow_dispatch:
inputs:
runtime:
type: choice
description: JS runtime
default: "npm"
options:
- "bun"
- "npm"
workflow_call:
push:
branches:
- master
paths:
- "src/docs/**"
workflow_run:
workflows:
- "🎉 Release new version"
types:
- completed
jobs:
deploy-docs:
timeout-minutes: 10
runs-on: ubuntu-latest
env:
runtime: ${{ github.event.inputs.runtime || 'npm'}}
LEMONSQUEEZY_API_KEY: ${{ secrets.LEMONSQUEEZY_API_KEY }}
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_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 latest version if production
if: github.repository == 'saadeghi/daisyui'
run: cd src/docs && ${{ env.runtime }} i daisyui@latest
- 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 "latest" || 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 && ${{ 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 }}