Skip to content

Commit 1252a68

Browse files
authored
refactor(docs): adopt shared docs-kit chrome + call shared deploy workflow (#25)
1 parent bdf47be commit 1252a68

40 files changed

Lines changed: 474 additions & 705 deletions

.github/workflows/deploy-docs.yml

Lines changed: 8 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,17 @@
11
name: Deploy Docs
22

3+
# Deploys the docs site (docs/) to the oss-infrastructure server via Kamal when a
4+
# release is published, or on demand. The build+deploy logic is shared across all
5+
# docs-kit sites — see mhenrixon/docs-kit/.github/workflows/deploy.yml.
36
on:
47
release:
58
types: [published]
69
workflow_dispatch:
710

8-
concurrency:
9-
group: deploy-docs
10-
cancel-in-progress: false
11-
12-
permissions:
13-
contents: read
14-
packages: write
15-
1611
jobs:
17-
build:
18-
runs-on: ubuntu-latest
19-
outputs:
20-
image_tag: ${{ steps.tag.outputs.image_tag }}
21-
22-
steps:
23-
- uses: actions/checkout@v4
24-
25-
- name: Determine image tag
26-
id: tag
27-
env:
28-
EVENT_NAME: ${{ github.event_name }}
29-
RELEASE_TAG: ${{ github.event.release.tag_name }}
30-
run: |
31-
if [ "$EVENT_NAME" = "release" ]; then
32-
TAG="$RELEASE_TAG"
33-
else
34-
TAG="sha-$(git rev-parse --short HEAD)"
35-
fi
36-
echo "image_tag=$TAG" >> "$GITHUB_OUTPUT"
37-
echo "Building image tag: $TAG"
38-
39-
- name: Set up Docker Buildx
40-
uses: docker/setup-buildx-action@v3
41-
42-
- name: Login to GitHub Container Registry
43-
uses: docker/login-action@v3
44-
with:
45-
registry: ghcr.io
46-
username: ${{ github.actor }}
47-
password: ${{ secrets.GITHUB_TOKEN }}
48-
49-
- name: Build and push Docker image
50-
uses: docker/build-push-action@v6
51-
with:
52-
context: .
53-
file: docs/Dockerfile
54-
push: true
55-
tags: |
56-
ghcr.io/mhenrixon/daisyui:${{ steps.tag.outputs.image_tag }}
57-
ghcr.io/mhenrixon/daisyui:latest
58-
cache-from: type=registry,ref=ghcr.io/mhenrixon/daisyui:buildcache
59-
cache-to: type=registry,ref=ghcr.io/mhenrixon/daisyui:buildcache,mode=max
60-
6112
deploy:
62-
needs: build
63-
runs-on: ubuntu-latest
64-
environment: docs
65-
66-
steps:
67-
- uses: actions/checkout@v4
68-
69-
- uses: ruby/setup-ruby@v1
70-
with:
71-
ruby-version: "3.4"
72-
bundler-cache: true
73-
working-directory: docs
74-
75-
- name: Setup SSH agent
76-
uses: webfactory/ssh-agent@v0.9.1
77-
with:
78-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
79-
80-
- name: Configure SSH for the deploy host
81-
env:
82-
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
83-
run: |
84-
mkdir -p ~/.ssh
85-
chmod 700 ~/.ssh
86-
# Disable host-key verification for the deploy host. Kamal uses net-ssh,
87-
# which raises HostKeyMismatch on any known_hosts conflict (e.g. after
88-
# the server is reprovisioned). net-ssh honors ~/.ssh/config, so this
89-
# turns verification off for this single known IP. Acceptable here: a
90-
# public read-only docs site reached over an authenticated deploy key.
91-
cat >> ~/.ssh/config <<EOF
92-
Host $DEPLOY_HOST
93-
StrictHostKeyChecking no
94-
UserKnownHostsFile /dev/null
95-
EOF
96-
chmod 600 ~/.ssh/config
97-
98-
- name: Deploy with Kamal
99-
working-directory: docs
100-
env:
101-
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
102-
DEPLOY_DOMAIN: ${{ secrets.DEPLOY_DOMAIN }}
103-
KAMAL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
104-
IMAGE_TAG: ${{ needs.build.outputs.image_tag }}
105-
run: |
106-
bundle exec kamal deploy \
107-
--skip-push \
108-
--version="$IMAGE_TAG"
13+
uses: mhenrixon/docs-kit/.github/workflows/deploy.yml@main
14+
with:
15+
image: mhenrixon/daisyui
16+
service: daisyui
17+
secrets: inherit

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ node_modules
3939

4040
# Tailwind CSS builds
4141
/app/assets/builds
42+
# Generated by bin/build-css (resolved gem @source globs).
43+
/app/assets/stylesheets/tailwind.sources.css
4244

4345
.DS_Store
4446
.claude/settings.local.json

docs/.rubocop.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ plugins:
44
- rubocop-rake
55
- rubocop-rspec
66

7+
# Local custom cop: enforce the DocsUI/DaisyUI Phlex kit form
8+
# (DocsUI::Code(...)) over `render DocsUI::Code.new(...)`.
9+
require:
10+
- ./lib/rubocop/cop/docs_kit/render_component_preferred.rb
11+
12+
DocsKit/RenderComponentPreferred:
13+
Enabled: true
14+
Include:
15+
- app/**/*.rb
16+
Exclude:
17+
- lib/rubocop/cop/**/*.rb
18+
719
AllCops:
820
TargetRubyVersion: 3.4
921
NewCops: enable

docs/Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ gem "turbo-rails"
1919

2020
# Views
2121
gem "daisyui", path: ".."
22+
# Shared docs-site chrome (Shell/Sidebar/Code/Page/...) — the single place the
23+
# layout/design lives, shared with the phlex-reactive docs site. Configured
24+
# per-site via DocsKit.configure (config/initializers/docs_kit.rb). Referenced
25+
# from GitHub (not a local path) so the Docker build — whose context is THIS repo
26+
# — can resolve it; the gem lives in a sibling repo, outside the build context.
27+
gem "docs-kit", github: "mhenrixon/docs-kit", require: "docs_kit"
2228
gem "method_source"
2329
gem "phlex-rails"
2430
gem "phlex-reactive"

0 commit comments

Comments
 (0)