Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pre-commit
name: main ci pipeline

on:
pull_request:
Expand All @@ -7,9 +7,31 @@ on:
branches: [master]

jobs:
pre-commit:
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
# - uses: pre-commit/[email protected]
- name: checkout repo
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5

- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Install deps
run: uv sync

- name: Linter
run: uv run ruff check

docker-image-build:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v4

- name: build docker image
run: docker build . --tag ghcr.io/typst-http-api:${{ github.sha }}
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Docker Image CI for GHCR

on:
push:
tags:
- 'v*' # Trigger only on tags matching v*

jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Extract tag name
id: extract_tag
run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Log in to GHCR
run: docker login --username ${{ github.actor }} --password ${{ secrets.GH_PAT }} ghcr.io

- name: Build and push the image
run: |
docker build . --tag ghcr.io/typst-http-api:${{ steps.extract_tag.outputs.TAG_NAME }}
docker push ghcr.io/typst-http-api:${{ steps.extract_tag.outputs.TAG_NAME }}

- name: Build and push latest tag on main branch tag
if: github.ref == 'refs/tags/v*'
run: |
docker build . --tag ghcr.io/typst-http-api:${{ steps.extract_tag.outputs.TAG_NAME }}
docker push ghcr.io/typst-http-api:${{ steps.extract_tag.outputs.TAG_NAME }}

7 changes: 7 additions & 0 deletions example/caddy-reverse-proxy/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
http://localhost {

handle {
reverse_proxy typst-http-api:8000
}
}

16 changes: 16 additions & 0 deletions example/caddy-reverse-proxy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: "3.8"


services:
caddy:
image: caddy:2-alpine
ports:
- "4430:443"
- "8080:80"
environment:
- CADDY_ADMIN_DISABLED=true
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
typst-http-api:
build: ...

5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ dependencies = [
"uvicorn>=0.34.0",
]

[dependency-groups]
dev = [
"ruff>=0.11.4",
]



1 change: 0 additions & 1 deletion src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import logging

import typst
from fastapi import FastAPI, Request, Response, status
from fastapi.responses import StreamingResponse
Expand Down
33 changes: 33 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.