Skip to content

Deploy preview modpack #375

Deploy preview modpack

Deploy preview modpack #375

Workflow file for this run

name: Deploy preview modpack
permissions:
contents: write
deployments: write
on:
workflow_dispatch:
inputs:
version:
description: 'Modpack version'
required: true
preview_version:
description: 'Preview version'
required: true
env:
VERSION_NORMAL: "v${{ github.event.inputs.version }}-pr-${{ github.event.inputs.preview_version }}"
VERSION_LWJGL3: "v${{ github.event.inputs.version }}-lwjgl3-${{ github.event.inputs.preview_version }}"
NAME: "GTExpert2"
jobs:
deploy:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ "NORMAL", "LWJGL3" ]
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
- 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
sed -i -e "s/MODPACKVERSION/${{ env.VERSION_LWJGL3 }}/g" ./manifest.json
sed -i -e "s/MODPACKVERSION/${{ env.VERSION_LWJGL3 }}/g" ./instance.cfg
sed -i -e "s/MODPACKVERSION/${{ env.VERSION_LWJGL3 }}/g" ./overrides/config/craftpresence.json
- if: matrix.version == 'NORMAL'
name: Set the version (NORMAL)
run: |
echo "GregTech Expert 2 ${{ env.VERSION_NORMAL }}" > ./overrides/config/txloader/load/custommainmenu/version.txt
sed -i -e "s/MODPACKVERSION/${{ env.VERSION_NORMAL }}/g" ./manifest.json
sed -i -e "s/MODPACKVERSION/${{ env.VERSION_NORMAL }}/g" ./instance.cfg
sed -i -e "s/MODPACKVERSION/${{ env.VERSION_NORMAL }}/g" ./overrides/config/craftpresence.json
- 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: Run Python
env:
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: python buildtools/mod-install.py
- name: Remaove .gitkeep files
run: find . -name ".gitkeep" -type f -delete
- if: matrix.version == 'NORMAL'
name: Archive Release CF (NORMAL)
run: zip -r ./${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip ./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 (NORMAL)
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 (NORMAL)
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 }}
prerelease: true
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 }}
prerelease: true
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