Deploy Preview Modpack #417
Workflow file for this run
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 Preview Modpack | |
| permissions: | |
| contents: read | |
| deployments: write | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| target_branch: | |
| description: "Target branch for the preview" | |
| type: string | |
| required: true | |
| version: | |
| description: "Modpack version" | |
| required: true | |
| preview_version: | |
| description: "Preview version" | |
| required: true | |
| env: | |
| NAME: "GTExpert2" | |
| 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 }}" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-slim | |
| strategy: | |
| matrix: | |
| buildType: [standard, lwjgl3] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.inputs.target_branch || github.ref }} | |
| 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.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: | | |
| 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.VERSION_LWJGL3 }}-mmc.zip patches/ mmc-pack.json instance.cfg .minecraft/ | |
| else | |
| zip -r artifacts/${{ env.NAME }}-${{ env.VERSION_NORMAL }}-cf.zip manifest.json modlist.html overrides/config/ overrides/local/ overrides/resourcepacks/icons/ overrides/resourcepacks/GTExpert2-* 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/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 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: | |
| ref: ${{ github.event.inputs.target_branch || github.ref }} | |
| 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: Ensure Tag Exists | |
| if: "!startsWith(github.ref, 'refs/tags/')" | |
| run: | | |
| git config --global user.name "github-actions" | |
| git config --global user.email "[email protected]" | |
| git tag ${{ env.VERSION_NORMAL }} | |
| git push origin ${{ env.VERSION_NORMAL }} | |
| - name: Create or Update GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.VERSION_NORMAL }} | |
| name: "Preview ${{ env.VERSION_NORMAL }}" | |
| body: | | |
| ## GregTech Expert 2 - Preview Release | |
| 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: true | |
| 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 }} |