Skip to content

Commit 54d6c91

Browse files
committed
fix: ci
1 parent dfe75a2 commit 54d6c91

6 files changed

Lines changed: 37 additions & 37 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@ name: Upload Docker Image
66
# documentation.
77

88
on:
9-
push:
10-
# Publish semver tags as releases.
11-
tags: [ 'v*.*.*' ]
9+
release:
10+
types: [published]
1211

1312
env:
1413
# Use docker.io for Docker Hub if empty
@@ -39,13 +38,12 @@ jobs:
3938
# multi-platform images and export cache
4039
# https://github.com/docker/setup-buildx-action
4140
- name: Set up Docker Buildx
42-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
41+
uses: docker/setup-buildx-action@v3
4342

4443
# Login against a Docker registry except on PR
4544
# https://github.com/docker/login-action
4645
- name: Log into registry ${{ env.REGISTRY }}
47-
if: github.event_name != 'pull_request'
48-
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
46+
uses: docker/login-action@v3
4947
with:
5048
registry: ${{ env.REGISTRY }}
5149
username: ${{ secrets.DOCKER_USERNAME }}
@@ -55,18 +53,18 @@ jobs:
5553
# https://github.com/docker/metadata-action
5654
- name: Extract Docker metadata
5755
id: meta
58-
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
56+
uses: docker/metadata-action@v5
5957
with:
6058
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
6159

6260
# Build and push Docker image with Buildx (don't push on PR)
6361
# https://github.com/docker/build-push-action
6462
- name: Build and push Docker image
6563
id: build-and-push
66-
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
64+
uses: docker/build-push-action@v6
6765
with:
6866
context: .
69-
push: ${{ github.event_name != 'pull_request' }}
67+
push: true
7068
tags: ${{ steps.meta.outputs.tags }}
7169
labels: ${{ steps.meta.outputs.labels }}
7270
cache-from: type=gha

.github/workflows/python-publish.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
name: Upload Python Package
1010

1111
on:
12-
push:
13-
# Publish semver tags as releases.
14-
tags: [ 'v*.*.*' ]
12+
release:
13+
types: [published]
1514

1615
permissions:
1716
contents: read
@@ -34,4 +33,4 @@ jobs:
3433
- name: Build package
3534
run: python -m build
3635
- name: Publish package
37-
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
36+
uses: pypa/gh-action-pypi-publish@release/v1

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ FROM python:3.12
22

33
WORKDIR /app
44

5+
COPY . .
6+
57
ENV PYTHONUNBUFFERED=1
68

7-
RUN apt-get update && apt-get install -y libgl1 \
8-
&& rm -rf /var/lib/apt/lists/*
9+
RUN apt-get update && apt-get install -y libgl1
10+
11+
RUN pip install -r requirements.txt
912

10-
RUN pip install pdf2zh
13+
RUN pip install .
1114

1215
CMD ["pdf2zh", "-i"]

pdf2zh/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "1.7.8"
1+
__version__ = "1.7.9"
22
__author__ = "Byaidu"

requirements.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
charset-normalizer
2+
cryptography
3+
requests
4+
pymupdf
5+
tqdm
6+
tenacity
7+
doclayout-yolo
8+
numpy
9+
ollama
10+
deepl<1.19.1
11+
openai
12+
azure-ai-translation-text<=1.0.1
13+
gradio
14+
huggingface_hub
15+
torch

setup.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
from pathlib import Path
21
from pdf2zh import __version__, __author__
32
from setuptools import setup
43

5-
root_dir = Path(__file__).parent
6-
with open(root_dir / "README.md", encoding='utf-8') as f:
4+
with open("README.md", encoding='utf-8') as f:
75
readme = f.read()
86

7+
with open("requirements.txt", encoding='utf-8') as f:
8+
requirements = f.readlines()
9+
910
setup(
1011
name="pdf2zh",
1112
long_description=readme,
@@ -17,23 +18,7 @@
1718
author_email="byaidux@gmail.com",
1819
url="https://github.com/Byaidu/PDFMathTranslate",
1920
packages=["pdf2zh"],
20-
install_requires=[
21-
"charset-normalizer",
22-
"cryptography",
23-
"requests",
24-
"pymupdf",
25-
"tqdm",
26-
"tenacity",
27-
"doclayout-yolo",
28-
"numpy",
29-
"ollama",
30-
"deepl<1.19.1",
31-
"openai",
32-
"azure-ai-translation-text<=1.0.1",
33-
"gradio",
34-
"huggingface_hub",
35-
"torch",
36-
],
21+
install_requires=requirements,
3722
classifiers=[
3823
"Programming Language :: Python :: 3",
3924
"Operating System :: OS Independent",

0 commit comments

Comments
 (0)