Deploy Modpack #147
This file contains hidden or 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 Modpack | |
| permissions: | |
| contents: read | |
| 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: | |
| NAME: "GTExpert2" | |
| 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" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| buildType: [standard, lwjgl3] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.m2/repository | |
| ~/.cache/pip | |
| key: ${{ runner.os }}-deps-${{ matrix.buildType }}-${{ hashFiles('**/pom.xml') }} | |
| - 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: Setup Build Environment | |
| uses: ./.github/actions/build_setup | |
| - name: Create artifacts directory | |
| run: mkdir -p artifacts | |
| - name: Set Modpack Version | |
| run: | | |
| if [[ "${{ matrix.buildType }}" == "lwjgl3" ]]; then | |
| VER="${{ env.VERSION_LWJGL3 }}" | |
| echo "[CleanroomMMC] GregTech Expert 2 $VER" > overrides/config/txloader/load/custommainmenu/version.txt | |
| else | |
| VER="${{ env.VERSION_NORMAL }}" | |
| echo "GregTech Expert 2 $VER" > overrides/config/txloader/load/custommainmenu/version.txt | |
| fi | |
| sed -i "s/MODPACKVERSION/$VER/g" manifest.json instance.cfg overrides/config/craftpresence.json | |
| - name: Adjust for LWJGL3 | |
| if: matrix.buildType == 'lwjgl3' | |
| run: | | |
| python buildtools/gen-lwjgl3-manifest.py | |
| cp -vf cmmc/manifest.json manifest.json | |
| - name: Install Mods | |
| env: | |
| CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | |
| run: python buildtools/mod-install.py | |
| - name: Clean up placeholder files | |
| run: find . -name ".gitkeep" -delete | |
| - name: Package Artifacts | |
| run: | | |
| if [[ "${{ matrix.buildType }}" == "lwjgl3" ]]; then | |
| sed -i "s/B:EnableCustomGameTitle=false/B:EnableCustomGameTitle=true/" 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 artifacts/${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-mmc.zip libraries/ patches/ mmc-pack.json instance.cfg .minecraft/ | |
| else | |
| zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip manifest.json modlist.html overrides/bansoukou/ overrides/config/ overrides/local/ overrides/resourcepacks/ overrides/scripts/ | |
| mv overrides/ .minecraft/ | |
| cp icon.png .minecraft/ | |
| zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip mmc-pack.json instance.cfg .minecraft/ | |
| mv serverfiles/* ./ | |
| 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-* | |
| mv -vf .minecraft/* ./ | |
| zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip docker-compose.yml PleaseRead.txt log4j2_112-116.xml Install.* ServerStart.* settings.* TmuxServer.sh bansoukou/ config/ local/ mods/ resources/ scripts/ | |
| fi | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.buildType }}-artifacts | |
| path: artifacts/ | |
| retention-days: 1 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: downloads | |
| - name: Aggregate Artifacts | |
| run: | | |
| mkdir -p artifacts | |
| for d in downloads/*; do | |
| if [ -d "$d" ]; then | |
| cp -r "$d"/* artifacts/ || true | |
| fi | |
| done | |
| - name: Check or create tag | |
| run: | | |
| if git rev-parse --verify --quiet "${{ env.VERSION_NORMAL }}"; then | |
| echo "Tag exists." | |
| else | |
| git config --local user.name "github-actions" | |
| git config --local user.email "actions@github.com" | |
| git tag ${{ env.VERSION_NORMAL }} | |
| git push origin ${{ env.VERSION_NORMAL }} | |
| fi | |
| - name: Create or update GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.VERSION_NORMAL }} | |
| name: "Modpack ${{ env.VERSION_NORMAL }}" | |
| body: | | |
| ## GregTech Expert 2 - ${{ env.VERSION_NORMAL }} | |
| This preview includes: | |
| - **Standard** (CurseForge / MultiMC / PrismLauncher / Server) | |
| - **LWJGL3** (MultiMC / PrismLauncher only) | |
| See installation guide for LWJGL3 [here](https://github.com/GTModpackTeam/GregTech-Expert-2/blob/main/cmmc/README.md). | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip | |
| artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-mmc.zip | |
| artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-server.zip | |
| artifacts/${{ env.NAME }}-${{ env.VERSION_LWJGL3 }}-mmc.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |