Deploy Modpack #148
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" | |
| JAVA8_CF: "${{ github.event.inputs.version }}-CF_Java_8" | |
| JAVA8_MMC: "${{ github.event.inputs.version }}-MMC_Java_8" | |
| JAVA8_SERVER: "${{ github.event.inputs.version }}-Server_Java_8" | |
| JAVA_OPT: "${{ github.event.inputs.version }}-MMC_Java_17-25" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-slim | |
| strategy: | |
| matrix: | |
| buildType: [standard, lwjgl3] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - 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.JAVA8_CF }}" | |
| 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: | | |
| uv run --directory ./buildtools python ./gen-lwjgl3-manifest.py | |
| cp -vf cmmc/manifest.json manifest.json | |
| - name: Install Mods | |
| env: | |
| CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | |
| run: uv run --directory ./buildtools python ./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 | |
| mv -vf overrides/ .minecraft/ | |
| cp -vf icon.png .minecraft/ | |
| cp -rvf cmmc/* ./ | |
| zip -r artifacts/${{ env.NAME }}-${{ env.JAVA_OPT }}.zip patches/ mmc-pack.json instance.cfg .minecraft/ | |
| else | |
| zip -r artifacts/${{ env.NAME }}-${{ env.JAVA8_CF }}.zip manifest.json modlist.html overrides/config/ overrides/local/ overrides/resourcepacks/ overrides/scripts/ | |
| mv overrides/ .minecraft/ | |
| cp icon.png .minecraft/ | |
| zip -r artifacts/${{ env.NAME }}-${{ env.JAVA8_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/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-* | |
| mv -vf .minecraft/* ./ | |
| zip -r artifacts/${{ env.NAME }}-${{ env.JAVA8_SERVER }}.zip docker-compose.yml PleaseRead.txt log4j2_112-116.xml Install.* ServerStart.* settings.* TmuxServer.sh config/ local/ mods/ resources/ scripts/ | |
| fi | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: ${{ matrix.buildType }}-artifacts | |
| path: artifacts/ | |
| retention-days: 1 | |
| release: | |
| needs: build | |
| runs-on: ubuntu-slim | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download All Artifacts | |
| uses: actions/download-artifact@v6 | |
| 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.JAVA8_CF }}"; then | |
| echo "Tag exists." | |
| else | |
| git config --local user.name "github-actions" | |
| git config --local user.email "[email protected]" | |
| git tag ${{ env.JAVA8_CF }} | |
| git push origin ${{ env.JAVA8_CF }} | |
| fi | |
| - name: Create or update GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}" | |
| name: "v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}" | |
| body: | | |
| ## GregTech Expert 2 - {{ github.event.inputs.version }} | |
| This preview includes: | |
| - **Java 8** (CurseForge / MultiMC / PrismLauncher / Server) | |
| - **Java 17-25** (MultiMC / PrismLauncher only) | |
| See installation guide for Java 17-25 [here](https://github.com/GTModpackTeam/GregTech-Expert-2/blob/main/cmmc/). | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| artifacts/${{ env.NAME }}-${{ env.JAVA8_CF }}.zip | |
| artifacts/${{ env.NAME }}-${{ env.JAVA8_MMC }}.zip | |
| artifacts/${{ env.NAME }}-${{ env.JAVA8_SERVER }}.zip | |
| artifacts/${{ env.NAME }}-${{ env.JAVA_OPT }}.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |