Deploy modpack #5
This file contains 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: write | |
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: | |
# Version of the mod | |
FULL_VERSION: "v${{ github.event.inputs.version }}-${{ github.event.inputs.release_type }}" | |
# type of release | |
NAME: "GTExpert" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Check if tag already exists | |
run: | | |
if git rev-parse --verify --quiet "v${{ github.event.inputs.version }}"; then | |
echo "Version ${{ github.event.inputs.version }} already exists, aborting workflow." | |
exit 1 | |
fi | |
- name: Set the version | |
run: | | |
sed -i -e "s/MODPACKVERSION/v${{ github.event.inputs.version }}/g" ./manifest.json | |
sed -i -e "s/MODPACKVERSION/v${{ github.event.inputs.version }}/g" ./instance.cfg | |
- name: Archive Release CF | |
run: | | |
zip -r ./${{ env.NAME }}-${{ env.FULL_VERSION }}-cf.zip ./manifest.json ./modlist.html ./manifest.json ./modlist.html ./overrides/config/ ./overrides/scripts/ | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: pip | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./buildtools/requirements.txt | |
- name: Run Python | |
env: | |
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | |
run: python buildtools/mod-install.py | |
- name: Archive Release MMC | |
run: | | |
mv -vf ./overrides/ .minecraft/ | |
rm -rf ./xmods/ | |
zip -r ./${{ env.NAME }}-${{ env.FULL_VERSION }}-mmc.zip ./mmc-pack.json ./instance.cfg .minecraft/ | |
- name: Move Server Files | |
run: | | |
mv -vf ./serverfiles/* ./ | |
- name: Archive Release Server | |
run: | | |
mv -vf .minecraft/* ./ | |
zip -r ./${{ env.NAME }}-${{ env.FULL_VERSION }}-server.zip ./docker-compose.yml ./PleaseRead.txt ./Install.bat ./Install.sh ./ServerStart.bat ./ServerStart.sh ./settings.bat ./settings.sh ./TmuxServer.sh ./config/ ./mods/ ./scripts/ | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: "${{ env.FULL_VERSION }}" | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
files: | | |
./${{ env.NAME }}-${{ env.FULL_VERSION }}-cf.zip | |
./${{ env.NAME }}-${{ env.FULL_VERSION }}-mmc.zip | |
./${{ env.NAME }}-${{ env.FULL_VERSION }}-server.zip |