new blog post #180
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'}} | |
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: "latest" | |
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 | |
run: cd src/docs && ${{ env.runtime }} i daisyui@${{ github.event.inputs.npm-tag }} | |
- 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 }} |