Skip to content

Deploy modpack

Deploy modpack #118

Workflow file for this run

name: Deploy modpack
permissions:
contents: write
deployments: write
on:
workflow_dispatch:
inputs:
version:
description: 'Modpack version'
required: true
release_type:
description: 'Release type'
type: choice
default: 'release'
options:
- 'release'
- 'beta'
- 'alpha'
env:
# Version of the mod
FULL_VERSION: "v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}"
# type of release
NAME: "GTExpert2"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check if tag already exists
run: |
if git rev-parse --verify --quiet "v${{ github.event.inputs.version }}"; then
echo "Version ${{ github.event.inputs.version }} already exists, aborting workflow."
exit 1
fi
- name: Set the version
run: |
echo "GregTech Expert 2 ${{ env.FULL_VERSION }}" > ./overrides/resources/custommainmenu/version.txt
sed -i -e "s/MODPACKVERSION/v${{ github.event.inputs.version }}/g" ./manifest.json
sed -i -e "s/MODPACKVERSION/v${{ github.event.inputs.version }}/g" ./instance.cfg
sed -i -e "s/MODPACKVERSION/v${{ github.event.inputs.version }}/g" ./overrides/config/craftpresence.json
- name: Download Quest Book zip
run: |
wget -O questbook.zip https://github.com/GTModpackTeam/GregTech-Expert-2-FTBQuestBook/archive/refs/heads/main.zip
unzip questbook.zip
mv -vf ./GregTech-Expert-2-FTBQuestBook-main/* ./overrides/config/ftbquests/
rm -rf ./GregTech-Expert-2-FTBQuestBook-main/ ./questbook.zip
- name: Download Resource Packs zip
run: |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/GTModpackTeam/GTE2-Translations/releases/latest)
ASSET=$(echo $LATEST_RELEASE | jq -r '.assets[] | select(.name | test("GTExpert2-v[0-9.]+-resourcepack-v[0-9]+\\.zip")) | .name' | sort -V | tail -n 1)
ASSET_URL=$(echo $LATEST_RELEASE | jq -r --arg ASSET "$ASSET" '.assets[] | select(.name == $ASSET) | .browser_download_url')
wget -O ./overrides/resourcepacks/$ASSET $ASSET_URL
- name: Archive Release CF
run: |
zip -r ./${{ env.NAME }}-${{ env.FULL_VERSION }}-cf.zip ./manifest.json ./modlist.html ./manifest.json ./modlist.html ./overrides/bansoukou/ ./overrides/config/ ./overrides/local/ ./overrides/resourcepacks/icons/ ./overrides/resources/ ./overrides/scripts/
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r ./buildtools/requirements.txt
- name: Run Python
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: python buildtools/mod-install.py
- name: Archive Release MMC
run: |
mv -vf ./overrides/ .minecraft/
cp -vf ./icon.png .minecraft/
rm -rf .minecraft/mods/.gitkeep
rm -rf .minecraft/resourcepacks/.gitkeep
zip -r ./${{ env.NAME }}-${{ env.FULL_VERSION }}-mmc.zip ./mmc-pack.json ./instance.cfg .minecraft/
- name: Move Server Files
run: |
mv -vf ./serverfiles/* ./
- name: Archive Release Server
run: |
mv -vf .minecraft/* ./
zip -r ./${{ env.NAME }}-${{ env.FULL_VERSION }}-server.zip ./docker-compose.yml ./PleaseRead.txt ./log4j2_112-116.xml ./Install.bat ./Install.sh ./ServerStart.bat ./ServerStart.sh ./settings.bat ./settings.sh ./TmuxServer.sh ./bansoukou/ ./config/ ./local/ ./mods/ ./resources/ ./scripts/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: "${{ env.FULL_VERSION }}"
draft: false
prerelease: false
generate_release_notes: true
files: |
./${{ env.NAME }}-${{ env.FULL_VERSION }}-cf.zip
./${{ env.NAME }}-${{ env.FULL_VERSION }}-mmc.zip
./${{ env.NAME }}-${{ env.FULL_VERSION }}-server.zip
# - name: Upload Curseforge
# uses: juraj-hrivnak/[email protected]
# with:
# api-token: ${{ secrets.CF_API_TOKEN }}
# project-id: '565238'
# modpack-path: ./${{ env.NAME }}-${{ env.FULL_VERSION }}-cf.zip
# modpack-server-path: ./${{ env.NAME }}-${{ env.FULL_VERSION }}-server.zip
# changelog: 'Check the changes here. [Github - CHANGELOG.md](https://github.com/GTModpackTeam/gregtech-expert-2/blob/main/CHANGELOG_v2.md "")'
# changelog-format: markdown
# game-version: '1.12.2'
# display-name: ${{ env.NAME }}-${{ env.FULL_VERSION }}
# server-display-name: ${{ env.NAME }}-${{ env.FULL_VERSION }}-server
# release-type: ${{ github.event.inputs.release_type }}