Deploy Questbook #3
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: | |
modpack_version: | |
description: 'Modpack version' | |
required: true | |
questbook_version: | |
description: 'QuestBook version' | |
required: true | |
env: | |
MODPACK_VERSION: "v${{ github.event.inputs.modpack_version }}" | |
QUESTBOOK_VERSION: "v${{ github.event.inputs.questbook_version }}" | |
NAME: "GTExpert2" | |
FULL_NAME: "GTExpert2-v${{ github.event.inputs.modpack_version }}-ftbquests-${{ github.event.inputs.questbook_version }}" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
language: ['EN-US', 'ZH'] | |
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 zip | |
run: | | |
wget -O questbook.zip https://github.com/GTModpackTeam/GregTech-Expert-2-FTBQuestBook/archive/refs/heads/main.zip | |
unzip questbook.zip | |
mkdir ./ftbquests/ | |
mv -vf ./GregTech-Expert-2-FTBQuestBook-main/* ./ftbquests/ | |
rm -rf ./GregTech-Expert-2-FTBQuestBook-main/ ./questbook.zip | |
- 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: python ./buildtools/questbook/translate.py | |
- name: Archive Release | |
run: | | |
zip -r ./${{ env.FULL_NAME }}-${{ matrix.language }}.zip ./ftbquests-tl-${{ matrix.language }}/ | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: "${{ env.MODPACK_VERSION }}" | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
files: | | |
./${{ env.FULL_NAME }}-*.zip |