-
Notifications
You must be signed in to change notification settings - Fork 14
58 lines (51 loc) · 2.15 KB
/
python-docxloader.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Python DocxLoader Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build-and-run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install poetry
poetry config virtualenvs.create false
poetry install --no-root
- name: Copy input.docx and config.yaml
run: |
python download.py output/${{ vars.CN_TITLE }} ${{ vars.CN_TITLE }} ${{ secrets.S3_ACCESS_KEY }} ${{ secrets.S3_SECRET_KEY }} ${{ secrets.S3_ENDPOINT }} ${{ secrets.S3_BUCKET_NAME }}
if [ -n "${{ secrets.TRANSLATION_CONFIG }}" ]; then
echo "${{ secrets.TRANSLATION_CONFIG }}" > translation.yaml
else
sed -i 's/POE-API-KEY/'"${{ secrets.POE_API_KEY }}"'/g' translation.yaml.example
sed -i 's/GOOGLE-API-KEY/'"${{ secrets.GOOGLE_API_KEY }}"'/g' translation.yaml.example
mv translation.yaml.example translation.yaml
fi
sed -i 's/CN-TITLE/'"${{ vars.CN_TITLE }}"'/g' .env.example
sed -i 's/JP-TITLE/'"${{ vars.JP_TITLE }}"'/g' .env.example
sed -i 's/PROMPT-EXAMPLE/'"${{ vars.PROMPT }}"'/g' .env.example
sed -i 's/BILLING-EXAMPLE/'"${{ vars.BILLING }}"'/g' .env.example
sed -i 's/TRANSLATION-TITLE-RETRY-COUNT/'"${{ vars.TRANSLATION_TITLE_RETRY_COUNT }}"'/g' .env.example
mv .env.example .env
cat .env
- name: Run docxloader.py script
run: |
python monitor.py output/${{ vars.CN_TITLE }} ${{ vars.CN_TITLE }} ${{ secrets.S3_ACCESS_KEY }} ${{ secrets.S3_SECRET_KEY }} ${{ secrets.S3_ENDPOINT }} ${{ secrets.S3_BUCKET_NAME }} &
if [ "${{ vars.DRYRUN }}" = "True" ]; then
python docxloader.py --dryrun
else
python docxloader.py
fi
python monitor.py output/${{ vars.CN_TITLE }} ${{ vars.CN_TITLE }} ${{ secrets.S3_ACCESS_KEY }} ${{ secrets.S3_SECRET_KEY }} ${{ secrets.S3_ENDPOINT }} ${{ secrets.S3_BUCKET_NAME }} --final