Deploy Preview Modpack #13
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: "GTExpert" | |
| JAVA8_CF: "${{ github.event.inputs.version }}-Pre-${{ github.event.inputs.preview_version }}-CF_Java_8" | |
| JAVA8_MMC: "${{ github.event.inputs.version }}-Pre-${{ github.event.inputs.preview_version }}-MMC_Java_8" | |
| JAVA8_SERVER: "${{ github.event.inputs.version }}-Pre-${{ github.event.inputs.preview_version }}-Server_Java_8" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-slim | |
| strategy: | |
| matrix: | |
| buildType: [standard] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.inputs.target_branch || github.ref }} | |
| fetch-depth: 0 | |
| - name: Setup Build Environment | |
| uses: ./.github/actions/build_setup | |
| - name: Create artifacts directory | |
| run: mkdir -p artifacts | |
| - name: Set Modpack Version | |
| run: | | |
| sed -i -e "s/MODPACKVERSION/${MODPACKVERSION}/g" ./manifest.json | |
| sed -i -e "s/MODPACKVERSION/${MODPACKVERSION}/g" ./instance.cfg | |
| - 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: | | |
| zip -r artifacts/${{ env.NAME }}-${{ env.JAVA8_CF }}.zip manifest.json modlist.html overrides/config/ overrides/scripts/ | |
| mv overrides/ .minecraft/ | |
| zip -r artifacts/${{ env.NAME }}-${{ env.JAVA8_MMC }}.zip mmc-pack.json instance.cfg .minecraft/ | |
| mv serverfiles/* ./ | |
| mv -vf .minecraft/* ./ | |
| zip -r artifacts/${{ env.NAME }}-${{ env.JAVA8_SERVER }}.zip docker-compose.yml PleaseRead.txt Install.* ServerStart.* settings.* TmuxServer.sh config/ mods/ resources/ scripts/ | |
| - 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.JAVA8_CF }} | |
| git push origin ${{ env.JAVA8_CF }} | |
| - name: Create or Update GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "v${{ github.event.inputs.version }}-pr-${{ github.event.inputs.preview_version }}" | |
| name: "v${{ github.event.inputs.version }}-Pre-${{ github.event.inputs.preview_version }}" | |
| prerelease: true | |
| 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 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |