diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index 3d768cd0a..9cd1dd360 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -4,8 +4,16 @@ on: workflow_dispatch: jobs: - auto-update: + update-modpacks: runs-on: ubuntu-latest + strategy: + matrix: + modpack: [re-console, re-console-lite] + platform: [curseforge, modrinth] + loader: [fabric] + minecraft: [1.20.1, 1.20.4, 1.21.1, 1.21.3, 1.21.4, 1.21.5, 1.21.8] + max-parallel: 3 # Helps with rate limiting + fail-fast: false steps: - uses: actions/checkout@v4 @@ -21,10 +29,31 @@ jobs: - name: Install Packwiz run: go install github.com/packwiz/packwiz@latest - - name: Update + - name: Update ${{ matrix.modpack }} - ${{ matrix.platform }} - ${{ matrix.loader }} - ${{ matrix.minecraft }} run: | - sudo chmod +x update-all.sh - ./update-all.sh + DIR="./versions/vanilla/src/${{ matrix.modpack }}/${{ matrix.platform }}/${{ matrix.loader }}/${{ matrix.minecraft }}" + if [ -d "$DIR" ]; then + echo "Updating ${{ matrix.modpack }} ${{ matrix.platform }} ${{ matrix.loader }} ${{ matrix.minecraft }}" + cd "$DIR" + packwiz refresh -y + packwiz update -a -y + else + echo "Directory $DIR does not exist, skipping" + fi + + - name: Rate limiting delay + run: sleep 10 + + commit-changes: + needs: update-modpacks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_PAT }} + + - name: Pull latest changes + run: git pull origin main - name: Commit Updates uses: EndBug/add-and-commit@v9.1.4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2fa98b937..e9ff99c9b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,7 +11,82 @@ on: type: string jobs: + check-tag: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + version: ${{ steps.extract.outputs.version }} + is_alpha: ${{ steps.extract.outputs.is_alpha }} + is_lite: ${{ steps.extract.outputs.is_lite }} + pack_name: ${{ steps.extract.outputs.pack_name }} + source_path: ${{ steps.extract.outputs.source_path }} + modrinth_id: ${{ steps.extract.outputs.modrinth_id }} + curseforge_id: ${{ steps.extract.outputs.curseforge_id }} + steps: + - name: Check if tag starts with RC or Lite + id: check + run: | + if [ "${{ github.event_name }}" = "release" ]; then + tag="${{ github.event.release.tag_name }}" + if [[ "$tag" =~ ^(RC|Lite)[[:space:]]+[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then + echo "should_run=true" >> $GITHUB_OUTPUT + else + echo "should_run=false" >> $GITHUB_OUTPUT + echo "Tag '$tag' does not match pattern 'RC X.Y.Z' or 'Lite X.Y.Z'. Skipping workflow." + fi + else + # Always run for workflow_dispatch + echo "should_run=true" >> $GITHUB_OUTPUT + fi + + - name: Extract version and type from tag + id: extract + if: steps.check.outputs.should_run == 'true' + run: | + if [ "${{ github.event_name }}" = "release" ]; then + tag="${{ github.event.release.tag_name }}" + + # Check if it's a Lite release + if [[ "$tag" =~ ^Lite[[:space:]] ]]; then + echo "is_lite=true" >> $GITHUB_OUTPUT + echo "pack_name=Re-Console-Lite" >> $GITHUB_OUTPUT + echo "source_path=re-console-lite" >> $GITHUB_OUTPUT + echo "modrinth_id=legacy-minecraft-lite" >> $GITHUB_OUTPUT + echo "curseforge_id=re-console-lite" >> $GITHUB_OUTPUT + # Extract version after "Lite " + version=$(echo "$tag" | sed 's/^Lite[[:space:]]\+//') + else + echo "is_lite=false" >> $GITHUB_OUTPUT + echo "pack_name=Re-Console" >> $GITHUB_OUTPUT + echo "source_path=re-console" >> $GITHUB_OUTPUT + echo "modrinth_id=legacy-minecraft" >> $GITHUB_OUTPUT + echo "curseforge_id=re-console" >> $GITHUB_OUTPUT + # Extract version after "RC " + version=$(echo "$tag" | sed 's/^RC[[:space:]]\+//') + fi + + echo "version=$version" >> $GITHUB_OUTPUT + + # Check if it's an alpha release + if [[ "$version" == *"-alpha"* ]]; then + echo "is_alpha=true" >> $GITHUB_OUTPUT + echo "Alpha release detected - will only publish to GitHub" + else + echo "is_alpha=false" >> $GITHUB_OUTPUT + fi + else + # Default values for workflow_dispatch + echo "is_lite=false" >> $GITHUB_OUTPUT + echo "is_alpha=false" >> $GITHUB_OUTPUT + echo "pack_name=Re-Console" >> $GITHUB_OUTPUT + echo "source_path=re-console" >> $GITHUB_OUTPUT + echo "modrinth_id=legacy-minecraft" >> $GITHUB_OUTPUT + echo "curseforge_id=re-console" >> $GITHUB_OUTPUT + fi + build: + needs: check-tag + if: needs.check-tag.outputs.should_run == 'true' strategy: matrix: include: @@ -69,7 +144,8 @@ jobs: runs-on: ubuntu-latest env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PACK_NAME: Re-Console + PACK_NAME: ${{ needs.check-tag.outputs.pack_name }} + SOURCE_PATH: ${{ needs.check-tag.outputs.source_path }} OUTPUT: artifacts outputs: @@ -98,7 +174,8 @@ jobs: if [ -n "${{ github.event.inputs.version_override }}" ]; then version="${{ github.event.inputs.version_override }}" elif [ "${{ github.event_name }}" = "release" ]; then - version="${{ github.event.release.tag_name }}" + # Use the extracted version from the tag + version="${{ needs.check-tag.outputs.version }}" else version="dev-$(date +%Y%m%d-%H%M%S)" fi @@ -107,11 +184,18 @@ jobs: - name: Build modpack run: | - mkdir RC-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp - cp -r ./versions/vanilla/src/re-console/${{ matrix.platform }}/${{ matrix.loader }}/${{ matrix.version }}/* ./RC-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp/ - cp ./LICENSE ./RC-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp/ - cp ./README.md ./RC-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp/ - cd ./RC-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp/ + # Create temp directory with appropriate prefix + if [ "${{ needs.check-tag.outputs.is_lite }}" = "true" ]; then + temp_dir="RC-Lite-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp" + else + temp_dir="RC-${{ matrix.platform }}-${{ matrix.loader }}-${{ matrix.version }}-temp" + fi + + mkdir $temp_dir + cp -r ./versions/vanilla/src/${{ env.SOURCE_PATH }}/${{ matrix.platform }}/${{ matrix.loader }}/${{ matrix.version }}/* ./$temp_dir/ + cp ./LICENSE ./$temp_dir/ + cp ./README.md ./$temp_dir/ + cd ./$temp_dir/ packwiz refresh mkdir -p ../$OUTPUT packwiz ${{ matrix.platform }} export --output ../${OUTPUT}/${PACK_NAME}-${{ matrix.version }}-${{ matrix.loader }}-${{ steps.version.outputs.version }}-${{ matrix.platform }}.${{ matrix.file_ext }} @@ -124,7 +208,8 @@ jobs: retention-days: 1 publish-modrinth: - needs: build + needs: [check-tag, build] + if: needs.check-tag.outputs.should_run == 'true' && needs.check-tag.outputs.is_alpha == 'false' runs-on: ubuntu-latest strategy: matrix: @@ -143,7 +228,7 @@ jobs: loader: "fabric" max-parallel: 1 # Ensures sequential uploads env: - PACK_NAME: Re-Console + PACK_NAME: ${{ needs.check-tag.outputs.pack_name }} VERSION: ${{ needs.build.outputs.version }} COMMIT_SHORT_SHA: ${{ needs.build.outputs.commit-sha }} @@ -157,13 +242,13 @@ jobs: - name: Publish to Modrinth uses: Kir-Antipov/mc-publish@v3.3 with: - modrinth-id: legacy-minecraft + modrinth-id: ${{ needs.check-tag.outputs.modrinth_id }} modrinth-token: ${{ secrets.MR }} files: | artifacts/${{ env.PACK_NAME }}-${{ matrix.version }}-${{ matrix.loader }}-${{ env.VERSION }}-modrinth.mrpack - name: "RC ${{ env.VERSION }} (${{ matrix.loader == 'neoforged' && 'NeoForge' || 'Fabric' }} ${{ matrix.version }})" + name: "${{ needs.check-tag.outputs.is_lite == 'true' && 'RC-Lite' || 'RC' }} ${{ env.VERSION }} (${{ matrix.loader == 'neoforged' && 'NeoForge' || 'Fabric' }} ${{ matrix.version }})" version: "${{ env.VERSION }}-${{ matrix.loader }}-${{ matrix.version }}" version-type: ${{ github.event_name == 'release' && (contains(github.event.release.tag_name, 'alpha') && 'alpha' || contains(github.event.release.tag_name, 'beta') && 'beta' || 'release') || 'alpha' }} @@ -177,7 +262,8 @@ jobs: fail-mode: warn publish-curseforge: - needs: build + needs: [check-tag, build] + if: needs.check-tag.outputs.should_run == 'true' && needs.check-tag.outputs.is_alpha == 'false' runs-on: ubuntu-latest strategy: matrix: @@ -196,7 +282,7 @@ jobs: loader: "fabric" max-parallel: 1 # Ensures sequential uploads env: - PACK_NAME: Re-Console + PACK_NAME: ${{ needs.check-tag.outputs.pack_name }} VERSION: ${{ needs.build.outputs.version }} COMMIT_SHORT_SHA: ${{ needs.build.outputs.commit-sha }} @@ -210,13 +296,13 @@ jobs: - name: Publish to CurseForge uses: Kir-Antipov/mc-publish@v3.3 with: - curseforge-id: re-console + curseforge-id: ${{ needs.check-tag.outputs.curseforge_id }} curseforge-token: ${{ secrets.CF }} files: | artifacts/${{ env.PACK_NAME }}-${{ matrix.version }}-${{ matrix.loader }}-${{ env.VERSION }}-curseforge.zip - name: "RC ${{ env.VERSION }} (${{ matrix.loader == 'neoforged' && 'NeoForge' || 'Fabric' }} ${{ matrix.version }})" + name: "${{ needs.check-tag.outputs.is_lite == 'true' && 'RC-Lite' || 'RC' }} ${{ env.VERSION }} (${{ matrix.loader == 'neoforged' && 'NeoForge' || 'Fabric' }} ${{ matrix.version }})" version: "${{ env.VERSION }}-${{ matrix.loader }}-${{ matrix.version }}" version-type: ${{ github.event_name == 'release' && (contains(github.event.release.tag_name, 'alpha') && 'alpha' || contains(github.event.release.tag_name, 'beta') && 'beta' || 'release') || 'alpha' }} @@ -230,11 +316,11 @@ jobs: fail-mode: warn publish-github: - needs: build + needs: [check-tag, build] + if: needs.check-tag.outputs.should_run == 'true' && github.event_name == 'release' runs-on: ubuntu-latest - if: github.event_name == 'release' env: - PACK_NAME: Re-Console + PACK_NAME: ${{ needs.check-tag.outputs.pack_name }} VERSION: ${{ needs.build.outputs.version }} COMMIT_SHORT_SHA: ${{ needs.build.outputs.commit-sha }} @@ -250,7 +336,8 @@ jobs: find all-artifacts -name "*.zip" -exec cp {} combined-release/ \; find all-artifacts -name "*.mrpack" -exec cp {} combined-release/ \; cd combined-release - zip -r ../RC-${{ env.VERSION }}-All.zip . + zip_name="${{ needs.check-tag.outputs.is_lite == 'true' && 'RC-Lite' || 'RC' }}-${{ env.VERSION }}-All.zip" + zip -r "../$zip_name" . - name: Upload to GitHub Release uses: Kir-Antipov/mc-publish@v3.3 @@ -258,9 +345,9 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} files: | - RC-${{ env.VERSION }}-All.zip + ${{ needs.check-tag.outputs.is_lite == 'true' && 'RC-Lite' || 'RC' }}-${{ env.VERSION }}-All.zip - name: "RC ${{ env.VERSION }} - All" + name: "${{ needs.check-tag.outputs.is_lite == 'true' && 'RC-Lite' || 'RC' }} ${{ env.VERSION }} - All" version: "${{ env.VERSION }}" loaders: | diff --git a/.github/workflows/rc-nightly.yml b/.github/workflows/rc-builds.yml similarity index 92% rename from .github/workflows/rc-nightly.yml rename to .github/workflows/rc-builds.yml index 009c8257f..aca38ba02 100644 --- a/.github/workflows/rc-nightly.yml +++ b/.github/workflows/rc-builds.yml @@ -1,10 +1,16 @@ -name: RC Nighty Builds +name: RC Builds -on: [push, pull_request] - branches: [ "main" ] - paths: - - 'versions/vanilla/src/re-console/curseforge/**' - - 'versions/vanilla/src/re-console/modrinth/**' +on: + push: + branches: [ "main" ] + paths: + - 'versions/vanilla/src/re-console/curseforge/**' + - 'versions/vanilla/src/re-console/modrinth/**' + pull_request: + branches: [ "main" ] + paths: + - 'versions/vanilla/src/re-console/curseforge/**' + - 'versions/vanilla/src/re-console/modrinth/**' workflow_dispatch: diff --git a/.github/workflows/rc-lite-nightly.yml b/.github/workflows/rc-lite-builds.yml similarity index 91% rename from .github/workflows/rc-lite-nightly.yml rename to .github/workflows/rc-lite-builds.yml index 49f7c571f..ef65abe46 100644 --- a/.github/workflows/rc-lite-nightly.yml +++ b/.github/workflows/rc-lite-builds.yml @@ -1,10 +1,16 @@ -name: RC-Lite Nighty Builds +name: RC-Lite Builds -on: [push, pull_request] - branches: [ "main" ] - paths: - - 'versions/vanilla/src/re-console-lite/curseforge/**' - - 'versions/vanilla/src/re-console-lite/modrinth/**' +on: + push: + branches: [ "main" ] + paths: + - 'versions/vanilla/src/re-console-lite/curseforge/**' + - 'versions/vanilla/src/re-console-lite/modrinth/**' + pull_request: + branches: [ "main" ] + paths: + - 'versions/vanilla/src/re-console-lite/curseforge/**' + - 'versions/vanilla/src/re-console-lite/modrinth/**' workflow_dispatch: diff --git a/justfile b/justfile deleted file mode 100644 index e9bc922ab..000000000 --- a/justfile +++ /dev/null @@ -1,47 +0,0 @@ -# justfile is from SkywardMC https://github.com/skywardmc/.github -alias e := export -alias r := refresh -alias u := update - -set windows-shell := ["powershell.exe", "-NoLogo", "-Command"] - -default: - @just --list - -[private] -[windows] -_batchcmd cmd loader: - Get-ChildItem -Path versions\{{ if loader == "all" { "*\\*" } else { loader } }} -Directory | % { \ - Set-Location $_.FullName; \ - Write-Host "running {{ cmd }} in" versions\loader\$_; \ - Invoke-Expression "{{ cmd }}"; \ - Pop-Location; \ - } - -[linux] -[macos] -[private] -_batchcmd cmd loader: - for d in versions/{{ if loader == "all" { "*" } else { loader } }}/*/; do \ - pushd "$d" &> /dev/null; \ - echo "running {{ cmd }} in $d..."; \ - {{ cmd }}; \ - popd &> /dev/null; \ - done - -# all versions of (or "all") will be exported as a modrinth modpack -[linux] -[macos] -export loader: && (_batchcmd "packwiz modrinth export; mv *.mrpack ../../../build/" loader) - -mkdir -p build/ - -# all versions of (or "all") will be exported as a modrinth modpack -[windows] -export loader: && (_batchcmd "packwiz modrinth export; Move-Item -Force -Path *.mrpack -Destination ../../../build/" loader) - -New-Item -Force -Type Directory -Path build/ - -# all versions of (or "all") will have pack.toml & index.toml refreshed -refresh loader: && (_batchcmd "packwiz refresh" loader) - -# all versions of (or "all") will be updated -update loader: && (_batchcmd "packwiz update --all" loader) diff --git a/update-all.sh b/update-all.sh deleted file mode 100755 index 474f032bf..000000000 --- a/update-all.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# Vanilla Modpacks -vpacks=( - re-console - re-console-lite -) -# Platform Version -pfvs=( - curseforge - modrinth -) -# Mod Loader Version -mlvs=( - fabric -) -# Minecraft Version -mcvs=( - 1.20.1 - 1.20.4 - 1.21.1 - 1.21.3 - 1.21.4 - 1.21.5 - 1.21.8 -) - -for i in "${vpacks[@]}"; do - for q in "${pfvs[@]}"; do - for w in "${mlvs[@]}"; do - for e in "${mcvs[@]}"; do - DIR="./versions/vanilla/src/$i/$q/$w/$e" - if [ -d "$DIR" ]; then - echo - echo Updating $i $q $w $e - (cd $DIR && packwiz refresh -y && packwiz update -a -y) - fi - done - if [ -d "./versions/vanilla/src/$i/$q/$w" ]; then - echo - echo Waiting 20s for rate-limiting - echo - sleep 20 - fi - done - done -done \ No newline at end of file