Skip to content

Commit 2f88177

Browse files
committed
feat(ci): add Dockerfile, GitHub Actions, and action metadata for deployment
1 parent 7941bbf commit 2f88177

File tree

6 files changed

+199
-0
lines changed

6 files changed

+199
-0
lines changed

.dockerignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Build artifacts
2+
target/
3+
4+
# Git
5+
.git/
6+
.github/
7+
8+
# Node modules
9+
node_modules/
10+
11+
# Documentation
12+
docs/
13+
*.md
14+
!README.md
15+
16+
# IDE
17+
.idea/
18+
.vscode/
19+
*.swp
20+
*.swo
21+
22+
# Examples output
23+
examples/*/public/
24+
25+
# Temporary files
26+
tmp/
27+
*.tmp
28+
*.bak
29+
30+
# OS files
31+
.DS_Store
32+
Thumbs.db
33+
34+
# Test artifacts
35+
*.log
36+
coverage/

.github/workflows/deploy-pages.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Deploy examples/blog to GitHub Pages
2+
name: Deploy to GitHub Pages
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- main
9+
workflow_dispatch:
10+
11+
# Sets permissions for deployment
12+
permissions:
13+
contents: write
14+
15+
# Allow only one concurrent deployment
16+
concurrency:
17+
group: 'pages'
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build-and-deploy:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Build with Typstify
28+
uses: longcipher/typstify@master
29+
with:
30+
command: build
31+
config: config.toml
32+
output: public
33+
working-directory: examples/blog
34+
35+
- name: Deploy to GitHub Pages
36+
uses: JamesIves/github-pages-deploy-action@v4
37+
with:
38+
folder: examples/blog/public
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Deploy examples/blog to Cloudflare Workers
2+
name: Deploy to Cloudflare Workers
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
- main
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
deployments: write
14+
15+
jobs:
16+
deploy:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Build with Typstify
23+
uses: longcipher/typstify@master
24+
with:
25+
command: build
26+
config: config.toml
27+
output: public
28+
working-directory: examples/blog
29+
30+
- name: Deploy to Cloudflare Pages
31+
uses: cloudflare/wrangler-action@v3
32+
with:
33+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
34+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
35+
command: pages deploy examples/blog/public --project-name=typstify-blog

Dockerfile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Stage 1: Build typstify binary
2+
FROM rust:latest AS builder
3+
4+
WORKDIR /usr/src/app
5+
6+
# Copy source code
7+
COPY . .
8+
9+
# Build release binary
10+
RUN cargo build --release --package typstify
11+
12+
# Stage 2: Runtime environment (slim for smaller image)
13+
FROM debian:bookworm-slim
14+
15+
# Install required runtime dependencies
16+
RUN apt-get update && \
17+
apt-get install -y --no-install-recommends \
18+
ca-certificates \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
# Copy built binary from builder stage
22+
COPY --from=builder /usr/src/app/target/release/typstify /usr/local/bin/typstify
23+
24+
# Copy entrypoint script
25+
COPY entrypoint.sh /entrypoint.sh
26+
RUN chmod +x /entrypoint.sh
27+
28+
# Set working directory (GitHub Action mounts repo here)
29+
WORKDIR /github/workspace
30+
31+
# Use entrypoint script for flexible working directory support
32+
ENTRYPOINT ["/entrypoint.sh"]
33+
34+
# Default command (can be overridden)
35+
CMD ["build"]

action.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: 'Typstify'
2+
description: 'Build static sites with Typstify - A high-performance static site generator with Typst/Markdown support'
3+
author: 'longcipher'
4+
5+
branding:
6+
icon: 'book-open'
7+
color: 'blue'
8+
9+
inputs:
10+
command:
11+
description: 'Command to run (build, check)'
12+
required: false
13+
default: 'build'
14+
config:
15+
description: 'Path to configuration file'
16+
required: false
17+
default: 'config.toml'
18+
output:
19+
description: 'Output directory for build command'
20+
required: false
21+
default: 'public'
22+
drafts:
23+
description: 'Include draft posts in build'
24+
required: false
25+
default: 'false'
26+
working-directory:
27+
description: 'Working directory (relative to repository root)'
28+
required: false
29+
default: '.'
30+
31+
outputs:
32+
output-path:
33+
description: 'Path to the generated site output directory'
34+
35+
runs:
36+
using: 'docker'
37+
image: 'Dockerfile'
38+
env:
39+
TYPSTIFY_WORKING_DIR: ${{ inputs.working-directory }}
40+
args:
41+
- ${{ inputs.command }}
42+
- '--config'
43+
- ${{ inputs.config }}
44+
- '--output'
45+
- ${{ inputs.output }}

entrypoint.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Change to working directory if specified
5+
if [ -n "$TYPSTIFY_WORKING_DIR" ] && [ "$TYPSTIFY_WORKING_DIR" != "." ]; then
6+
cd "$TYPSTIFY_WORKING_DIR"
7+
fi
8+
9+
# Execute typstify with all arguments
10+
exec typstify "$@"

0 commit comments

Comments
 (0)