Skip to content

Commit a6ac196

Browse files
committed
add github workflow, improve readme
1 parent 1c8fb26 commit a6ac196

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/build.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
push:
3+
tags:
4+
- "*"
5+
6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}
9+
10+
jobs:
11+
build-and-push-image:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
- name: Log in to the Container registry
22+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
23+
with:
24+
registry: ${{ env.REGISTRY }}
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta
30+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
31+
with:
32+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33+
34+
- name: Build and push Docker image
35+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
36+
with:
37+
context: .
38+
push: true
39+
tags: ${{ steps.meta.outputs.tags }}
40+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
WebTeX Render is a simple program used to generate static images from LaTeX equations. It was designed to be used as
1010
an alternative to <https://latex.codecogs.com/>. It also allows you to use arbitrary LaTeX packages in your images.
1111

12+
We also provide a simple web API to generate images on demand.
13+
1214
## Usage
1315

1416
```shell
@@ -30,6 +32,19 @@ img.math.inline {
3032
}
3133
```
3234

35+
## Using the web API
36+
37+
The `webtex_web` requires a configuration file to define "renderers".
38+
39+
```yaml
40+
- name: render_name
41+
key: secret
42+
template: template.tex
43+
```
44+
45+
The TeX image can be then generated at URL `http://...:8080/render/render_name/?eq=EQUATION&sig=SIGNATURE`.
46+
`EQUATION` should be a base64 encoded TeX. `SIGNATURE` should be a HMAC-SHA-256 of the `EQUATION` using the key from config.
47+
3348
## Minimal template
3449

3550
```tex
@@ -50,4 +65,19 @@ the document to make sure that all output files are at least `1em` high.
5065

5166
```shell
5267
go build -o wr ./webtex_render
68+
go build -o wr_web ./webtex_web
5369
```
70+
71+
## Docker image
72+
73+
We also provide a Docker image. The image contains both `wr` and `wr_web` binaries, but is set up to start the web
74+
API by default.
75+
76+
```shell
77+
docker run --rm \
78+
-v ./config.yml:/app/config.yml:ro \
79+
-v ./template.tex:/app/template.tex:ro \
80+
-p 8080:8080 \
81+
ghcr.io/naboj-org/webtex_render
82+
```
83+

0 commit comments

Comments
 (0)