Sodium #42
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: CI | |
on: | |
push: | |
branches: [ dev ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get latest release version | |
id: latest-release | |
uses: fangqiuming/[email protected] | |
- name: Replace version | |
run: | | |
echo "VERSION=${{ steps.latest-release.outputs.tag_name }}-$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
sed -i "s/_VERSION_/${{ steps.latest-release.outputs.tag_name }}/g" config/fabric_loader_dependencies.json | |
find . -type f -exec sed -i "s/_VERSION_/${{ steps.latest-release.outputs.tag_name }}-$(git rev-parse --short "$GITHUB_SHA")/g" {} + | |
find . -type f -exec sed -i "s/_COMMIT_/${{ github.sha }}/g" {} + | |
- name: Install Packwiz | |
run: | | |
sudo curl -L https://github.com/REVanillaW/packwiz/releases/download/CI/packwiz-linux-amd64 -o /bin/packwiz | |
sudo chmod +x /bin/packwiz | |
packwiz refresh --build | |
- name: Export Modrinth modpack | |
run: | | |
packwiz rehash sha512 | |
packwiz modrinth export | |
- name: Upload Modrinth modpack | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Modrinth | |
path: Titanium Optimized-${{ env.VERSION }}.mrpack | |
if-no-files-found: error | |
- name: Export CurseForge modpack | |
run: | | |
packwiz rehash sha1 | |
packwiz curseforge export | |
- name: Upload CurseForge modpack | |
uses: actions/upload-artifact@v4 | |
with: | |
name: CurseForge | |
path: Titanium Optimized-${{ env.VERSION }}.zip | |
if-no-files-found: error | |
- name: Update mods | |
run: | | |
packwiz update --all -y | tee UPDATE_LOG | |
if [ `grep -c "All files are up to date!" UPDATE_LOG` -ne "1" ]; then echo "::warning title=Update Available::Some mods can be updated."; fi | |
run: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download a single artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: Modrinth | |
- name: Install Console Minecraft Launcher | |
run: curl -L https://github.com/MrShieh-X/console-minecraft-launcher/releases/download/2.2.1/cmcl.jar -o cmcl.jar | |
- name: Set up Java 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'zulu' | |
- name: Install modpack | |
run: | | |
mv *.mrpack CI.mrpack | |
java -jar cmcl.jar config downloadSource 0 | |
java -jar cmcl.jar modpack --file="CI.mrpack" --storage=CI --no-assets | |
- name: Run Minecraft | |
run: | | |
java -jar cmcl.jar account --login=offline --name=PlusVanilla | |
java -jar cmcl.jar config exitWithMinecraft true | |
java -jar cmcl.jar config printStartupInfo true | |
java -jar cmcl.jar config checkAccountBeforeStart false | |
echo "0" | java -jar cmcl.jar CI | tee output.log | |
if [ `grep -c "java.lang.IllegalStateException: Failed to initialize GLFW, errors: GLFW error during init" output.log` -ne "1" ]; then echo "::error title=Game crashed::Oops." && exit 1; fi |