-
Notifications
You must be signed in to change notification settings - Fork 6
97 lines (91 loc) · 2.97 KB
/
publish-nightly-lang-pack.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Publish nightly lang pack
on:
workflow_call:
inputs:
target_lang:
description: "Target language to run"
required: true
type: string
workflow_dispatch:
inputs:
target_lang:
description: "Target language to run"
required: true
type: choice
options:
- zh_CN
- ja_JP
- ko_KR
- pt_BR
- fr_FR
- es_ES
- tr_TR
- de_DE
- pl_PL
- ru_RU
env:
PARATRANZ_TOKEN: ${{ secrets.PARATRANZ_TOKEN }}
jobs:
nightly-build:
name: ${{ inputs.target_lang }} Nightly Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: master
- name: Get current date
id: date
shell: bash
run: |
echo "today=$(date --iso-8601)+${{ github.run_number }}" >> "$GITHUB_OUTPUT"
- name: Get project ID
id: get-project-id
uses: ./.github/actions/get-project-id
with:
target_lang: ${{ inputs.target_lang }}
- name: Ensure Dependencies
uses: ./.github/actions/ensure-dependencies
- name: Sync from ParaTranz
run: >-
poetry run python main.py action sync-from-paratranz
--subdirectory='${{ inputs.target_lang }}'
env:
PARATRANZ_PROJECT_ID: ${{ steps.get-project-id.outputs.project_id }}
TARGET_LANG: ${{ inputs.target_lang }}
- name: Ensure temp dir
run: mkdir temp
- name: Ensure assets dir
run: mkdir assets
- name: Pack
run: python .github/scripts/pack.py ${{ inputs.target_lang }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: GTNH-${{ inputs.target_lang }}-Translation-Nightly-${{ steps.date.outputs.today }}
path: ./temp/
- name: Zip
run: |
cd temp
zip -r ../assets/GTNH-${{ inputs.target_lang }}-Translation-Nightly-${{ steps.date.outputs.today }}.zip ./*
cd ..
- name: Push commits and tag
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config pull.rebase true
git pull origin master
git push -d origin ${{ inputs.target_lang }}-latest || :
gh release delete ${{ inputs.target_lang }}-latest || :
git tag ${{ inputs.target_lang }}-latest
git push origin ${{ inputs.target_lang }}-latest
git push origin master
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Release as Latest
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.target_lang }}-latest
name: ${{ inputs.target_lang }} Latest
files: |
./assets/GTNH-${{ inputs.target_lang }}-Translation-Nightly-${{ steps.date.outputs.today }}.zip
token: ${{ secrets.GITHUB_TOKEN }}