Skip to content

Deploy modpack

Deploy modpack #144

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_NORMAL: "v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}"
VERSION_LWJGL3: "v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}-lwjgl3"
NAME: "GTExpert2"
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ "NORMAL", "LWJGL3" ]
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: Setup Build
uses: ./.github/actions/build_setup
- name: Download Resource Packs zip
run: |
GITHUB_RELEASE=$(curl -s https://api.github.com/repos/GTModpackTeam/GTE2-Translations/releases)
ASSET_URL=$(echo $GITHUB_RELEASE | jq -r '.[]."assets"[]."browser_download_url"' | grep "resourcepack" | head -1)
ASSET_NAME=$(echo $ASSET_URL | awk -F'/' '{print $NF}')
wget -O ./overrides/resourcepacks/$ASSET_NAME $ASSET_URL
- name: Set the version
run: |
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
- if: matrix.version == 'LWJGL3'
name: Set the version (LWJGL3)
run: echo "[CleanroomMMC] GregTech Expert 2 ${{ env.VERSION_LWJGL3 }}" > ./overrides/config/txloader/load/custommainmenu/version.txt
- if: matrix.version == 'NORMAL'
name: Set the version (NORMAL)
run: echo "GregTech Expert 2 ${{ env.VERSION_NORMAL }}" > ./overrides/config/txloader/load/custommainmenu/version.txt
- if: matrix.version == 'LWJGL3'
name: Remove lwjgl3 not supported mods
run: |
python buildtools/gen-lwjgl3-manifest.py
cp -vf ./cmmc/manifest.json ./manifest.json
- name: Remaove .gitkeep files
run: find . -name ".gitkeep" -type f -delete
- name: Run Python
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: python buildtools/mod-install.py
- if: matrix.version == 'NORMAL'
name: Archive Release CF (NORMAL)
run: zip -r ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip ./manifest.json ./modlist.html ./manifest.json ./modlist.html ./overrides/bansoukou/ ./overrides/config/ ./overrides/local/ ./overrides/resourcepacks/ ./overrides/scripts/
- if: matrix.version == 'LWJGL3'
name: Archive Release MMC (LWJGL3)
run: |
sed -i -e "s/B:EnableCustomGameTitle=false/B:EnableCustomGameTitle=true/g" ./overrides/config/stellar_core.cfg
cp -rvf ./cmmc/bansoukou/ ./overrides/
rm -Rf ./cmmc/bansoukou/
mv -vf ./overrides/ .minecraft/
cp -vf ./icon.png .minecraft/
cp -rvf ./cmmc/* ./
zip -r ./${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-cmmc.zip ./libraries/ ./patches/ ./mmc-pack.json ./instance.cfg .minecraft/
- if: matrix.version == 'NORMAL'
name: Archive Release MMC (NORMAL)
run: |
mv -vf ./overrides/ .minecraft/
cp -vf ./icon.png .minecraft/
zip -r ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip ./mmc-pack.json ./instance.cfg .minecraft/
- if: matrix.version == 'NORMAL'
name: Move Server Files
run: |
mv -vf ./serverfiles/* ./
- name: Remove Client Only Mods
run: |
rm -vf .minecraft/mods/!Red-Core-*
rm -vf .minecraft/mods/Alfheim-*
rm -vf .minecraft/mods/Valkyrie-*
rm -vf .minecraft/mods/CraftPresence-*
rm -vf .minecraft/mods/Controlling-*
rm -vf .minecraft/mods/UniLib-*
rm -vf .minecraft/mods/CustomMainMenu-*
rm -vf .minecraft/mods/Fixeroo-*
rm -vf .minecraft/mods/FpsReducer-*
rm -vf .minecraft/mods/modernsplash-*
rm -vf .minecraft/mods/RenderLib-*
rm -vf .minecraft/mods/particleculling-*
rm -vf .minecraft/mods/EntityCulling-*
rm -vf .minecraft/mods/SmoothFont-*
rm -vf .minecraft/mods/InGameInfoXML-*
rm -vf .minecraft/mods/oauth-*
rm -vf .minecraft/mods/UntranslatedItems-*
rm -vf .minecraft/mods/vintagefix-*
- if: matrix.version == 'NORMAL'
name: Archive Release Server
run: |
mv -vf .minecraft/* ./
zip -r ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-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/
- if: matrix.version == 'NORMAL'
name: Create GitHub Release (NORMAL)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION_NORMAL }}
generate_release_notes: true
files: |
./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip
./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip
./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip
- if: matrix.version == 'LWJGL3'
name: Create GitHub Release (LWJGL3)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.VERSION_LWJGL3 }}
body: |
Note - This is LWJGL3 build and only available for MMC / PrismLauncher.
FOLLOW THE INSTALLATION GUIDE [HERE](https://github.com/GTModpackTeam/GregTech-Expert-2/blob/main/cmmc/README.md).
---
generate_release_notes: true
files: |
./${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-cmmc.zip
# - name: Upload Curseforge
# uses: HaXrBOT/[email protected]
# with:
# api-token: "${{ secrets.CF_API_TOKEN }}"
# project-id: "565238"
# modpack-path: "./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip"
# modpack-server-path: "./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip"
# changelog-path: "CHANGELOG_v2.md"
# changelog-format: "markdown"
# game-version: "1.12.2"
# display-name: "${{ env.NAME }}-${{ env.VERSION_NORMAL }}"
# server-display-name: "${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server"
# release-type: "${{ github.event.inputs.release_type }}"