Deploy Questbook #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Questbook | |
permissions: | |
contents: write | |
deployments: write | |
on: | |
workflow_dispatch: | |
inputs: | |
choice_language: | |
description: 'Language' | |
default: EN-US, ZH | |
required: true | |
questbook_branch: | |
description: 'QuestBook branch' | |
type: choice | |
default: 'main' | |
options: | |
- 'main' | |
- 'preview' | |
modpack_version: | |
description: 'Modpack version' | |
required: true | |
env: | |
MODPACK_VERSION: "v${{ github.event.inputs.modpack_version }}" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
language: ["${{ github.event.inputs.choice_language }}"] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check if tag already exists | |
run: | | |
if git rev-parse --verify --quiet "${{ env.MODPACK_VERSION }}"; then | |
echo "Version ${{ github.event.inputs.modpack_version }} already exists, aborting workflow." | |
exit 1 | |
fi | |
- name: Download quest json | |
run: wget -O ./DefaultQuests.json https://raw.githubusercontent.com/GTModpackTeam/GregTech-Expert-2/${{ github.event.inputs.questbook_branch }}/overrides/config/betterquesting/DefaultQuests.json | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: pip | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./buildtools/questbook/requirements.txt | |
- name: Run Python | |
env: | |
DEEPL_AUTH_KEY: ${{ secrets.DEEPL_AUTH_KEY }} | |
TARGET_LANG_CODE: ${{ matrix.language }} | |
run: | | |
mkdir ./bqu/ | |
python ./buildtools/questbook/translate.py | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: "${{ env.MODPACK_VERSION }}" | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
files: ./bqu/DefaultQuests_${{ matrix.language }}.json |