Skip to content

ParaTranz Workflow

ParaTranz Workflow #21

Workflow file for this run

name: "ParaTranz Workflow"
on:
workflow_dispatch: {}
schedule:
- cron: "5 16 * * *"
env:
paratranz_project_id: 9900
python_version: "3.13"
reusable_workflows_ref: main
LOGURU_LEVEL: "INFO"
jobs:
para_cache:
name: ParaTranz - Cache
runs-on: ubuntu-latest
outputs:
cache_hit: ${{ steps.para_cache.outputs.cache-hit }}
steps:
### Checkout Main Repo ###
- name: Checkout Repository - Main
uses: actions/checkout@v4
### Setup script dependencies ###
- name: Setup - Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Setup - Poetry Install
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Cache - Poetry Dependencies
id: poetry_dependencies_cache
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Setup - Poetry install dependencies
if: ${{ steps.poetry_dependencies_cache.outputs.cache-hit != 'true' }}
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
poetry install --no-interaction
### Start Script ###
- name: ParaTranz - Cache
env:
PROJECT_ID: ${{ env.paratranz_project_id }}
API_TOKEN: ${{ secrets.PARATRANZ_TOKEN }}
run: |
poetry run python scripts/00_paratranz_cache.py
- name: Cache - ParaTranz
id: para_cache
uses: actions/cache@v4
with:
path: .cache/paratranz_cache.txt
key: paratranz_cache-${{ hashFiles('.cache/paratranz_cache.txt') }}
para_summary:
name: ParaTranz - Summary
runs-on: ubuntu-latest
needs: [ para_cache ]
outputs:
modrinth_summary: ${{ steps.summary.outputs.modrinth_summary }}
if: ${{ needs.para_cache.outputs.cache_hit != 'true' }}
steps:
### Checkout Main Repo ###
- name: Checkout Repository - Main
uses: actions/checkout@v4
### Setup script dependencies ###
- name: Setup - Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Setup - Poetry Install
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Cache - Poetry Dependencies
id: poetry_dependencies_cache
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Setup - Poetry install dependencies
if: ${{ steps.poetry_dependencies_cache.outputs.cache-hit != 'true' }}
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
poetry install --no-interaction
### Start Script ###
- name: ParaTranz - Generate Summary
id: summary
env:
PROJECT_ID: ${{ env.paratranz_project_id }}
API_TOKEN: ${{ secrets.PARATRANZ_TOKEN }}
run: |
poetry run python scripts/01_paratranz_summary.py
{
echo 'modrinth_summary<<EOF'
cat modrinth_summary.txt
echo EOF
} >> "$GITHUB_OUTPUT"
para_paraify:
name: ParaTranz - Paraify
runs-on: ubuntu-latest
needs: [ para_cache ]
if: ${{ needs.para_cache.outputs.cache_hit != 'true' }}
steps:
### Checkout Main ###
- name: Checkout Repository - Main
uses: actions/checkout@v4
### Setup script dependencies ###
- name: Setup - Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Setup - Poetry Install
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Cache - Poetry Dependencies
id: poetry_dependencies_cache
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Setup - Poetry install dependencies
if: ${{ steps.poetry_dependencies_cache.outputs.cache-hit != 'true' }}
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
poetry install --no-interaction
### Start Script ###
- name: ParaTranz - Download Artifact
env:
PROJECT_ID: ${{ env.paratranz_project_id }}
API_TOKEN: ${{ secrets.PARATRANZ_TOKEN }}
run: |
poetry run python scripts/02_paratranz_download.py
- name: ParaTranz - Extract Artifact
run: |
poetry run python scripts/03_paratranz_extract.py
- name: ParaTranz - Minecraft Language JSON & Structure
run: |
poetry run python scripts/04_paratranz_language.py
- name: Cache - Restore Files Hash
id: cache_files_hash_restore
uses: actions/cache/restore@v4
with:
path: .cache/paratranz_files_cache.json
key: paratranz_files_cache-${{ hashFiles('.cache/paratranz_files_cache.json') }}
restore-keys: paratranz_files_cache-
- name: ParaTranz - Date Fixer
env:
PROJECT_ID: ${{ env.paratranz_project_id }}
API_TOKEN: ${{ secrets.PARATRANZ_TOKEN }}
run: |
poetry run python scripts/05_paratranz_datefixer.py
- name: Cache - Save Files Hash
uses: actions/cache/save@v4
with:
path: .cache/paratranz_files_cache.json
key: paratranz_files_cache-${{ hashFiles('.cache/paratranz_files_cache.json') }}
- name: GitHub - Compress Archive
run: |
cd .workdir
tar -zcvf MultiVersions-Archive.tar.gz MultiVersions
- name: GitHub - Upload Translate Artifact
uses: actions/upload-artifact@v4
with:
name: ParaTranslateSource
path: .workdir/MultiVersions-Archive.tar.gz
compression-level: 9
para_matrix:
name: GitHub - Matrix Setup
runs-on: ubuntu-latest
needs: [ para_paraify ]
outputs:
matrix_json: ${{ steps.gh_matrix.outputs.matrix_json }}
steps:
### Checkout Main Repo ###
- name: Checkout Repository - Main
uses: actions/checkout@v4
### Setup script dependencies ###
- name: Setup - Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Setup - Poetry Install
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Cache - Poetry Dependencies
id: poetry_dependencies_cache
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Setup - Poetry install dependencies
if: ${{ steps.poetry_dependencies_cache.outputs.cache-hit != 'true' }}
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
poetry install --no-interaction
### Start Script ###
- name: Poetry - Setup Matrix Json
id: gh_matrix
run: |
poetry run python scripts/06_github_matrix.py
para_packer:
name: ParaTranz - PackUp ${{ matrix.mc_version }}
runs-on: ubuntu-latest
needs: [ para_matrix ]
strategy:
matrix: ${{ fromJson(needs.para_matrix.outputs.matrix_json) }}
steps:
### Checkout Main Repo ###
- name: Checkout Repository - Main
uses: actions/checkout@v4
with:
fetch-depth: 0
### Setup script dependencies ###
- name: Setup - Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.python_version }}
- name: Setup - Poetry Install
uses: snok/install-poetry@v1
with:
version: 1.8.5
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Cache - Poetry Dependencies
id: poetry_dependencies_cache
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Setup - Poetry install dependencies
if: ${{ steps.poetry_dependencies_cache.outputs.cache-hit != 'true' }}
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
poetry install --no-interaction
### Start Script ###
- name: GitHub - Download Translate Artifact
uses: actions/download-artifact@v4
with:
name: ParaTranslateSource
- name: GitHub - Uncompress Archive
run: |
tar -zxvf MultiVersions-Archive.tar.gz
rm MultiVersions-Archive.tar.gz
- name: Packer - Generate Mcmeta
env:
mc_pack_format: ${{ matrix.mc_pack_format }}
mc_supported_formats_min: ${{ matrix.mc_supported_formats_min }}
mc_supported_formats_max: ${{ matrix.mc_supported_formats_max }}
run: |
poetry run python scripts/07_github_pack_meta.py
### Current we only have main folder, don't have multiversion
- name: Packer Tempoary - Move files
run: |
mv MultiVersions/Forge/main/* pack/assets/
- name: Packer - ResourcePack Image and License
run: |
mv ../pack-assets/pack.png .
mv ../pack-assets/LICENSE .
working-directory: pack
- name: Packer - PackSquash
uses: ComunidadAylas/PackSquash-action@v4
with:
packsquash_version: latest-unstable
artifact_name: ParaTranslationPack-${{ matrix.mc_version }}
options: |
pack_directory = 'pack'
['LICENSE']
force_include = true
para_modrinth:
name: Modrinth - Publish ${{ matrix.mc_version }}
runs-on: ubuntu-latest
# if: ${{ inputs.modrinth_publish }}
needs: [ para_matrix, para_packer, para_summary ]
strategy:
max-parallel: 1
matrix: ${{ fromJson(needs.para_matrix.outputs.matrix_json) }}
steps:
- name: GitHub - Generate Date
id: date
run: |
TODAY=$(TZ="Asia/Taipei" date +%Y%m%d)
TODAY_DASH=$(TZ="Asia/Taipei" date +%Y-%m-%d)
echo "today=$TODAY" >> "$GITHUB_OUTPUT"
echo "today_dash=$TODAY_DASH" >> "$GITHUB_OUTPUT"
- name: GitHub - Download ParaTranslationPack
uses: actions/download-artifact@v4
with:
name: ParaTranslationPack-${{ matrix.mc_version }}
- name: GitHub - Rename ParaTranslationPack
run: |
mv pack.zip ParaTranslationPack-${{ matrix.mc_version }}.zip
- name: Modrinth - Publish ${{ matrix.mc_version }}
uses: Kir-Antipov/[email protected]
with:
modrinth-id: 7DO0XWSK
modrinth-unfeature-mode: subset
name: Para 翻譯包 ${{ matrix.mc_version }}|${{ steps.date.outputs.today_dash }}
version: ${{ matrix.mc_version }}-${{ steps.date.outputs.today }}
version-type: release
changelog: |
${{ needs.para_summary.outputs.modrinth_summary}}
loaders: minecraft
game-versions: ${{ matrix.modrinth_version }}
files: |
ParaTranslationPack-${{ matrix.mc_version }}.zip
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}