diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 98933cfe0f..9a5c3b2dae 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -21,5 +21,16 @@ jobs: uses: actions/setup-java@v1 with: java-version: 17 + - name: Update bundles + if: ${{ github.repository == 'Anuken/Mindustry' }} + run: | + ./gradlew updateBundles + git diff --exit-code + if [ $? ]; + then + git add core/assets/bundles/* + git commit -m "Automatic bundle update" + git push + fi - name: Run unit tests run: ./gradlew clean cleanTest test --stacktrace diff --git a/tools/src/mindustry/tools/BundleLauncher.java b/tools/src/mindustry/tools/BundleLauncher.java index 6b8be473c5..19e9e32374 100644 --- a/tools/src/mindustry/tools/BundleLauncher.java +++ b/tools/src/mindustry/tools/BundleLauncher.java @@ -56,7 +56,7 @@ public class BundleLauncher{ int added = 0; for(String key : base.orderedKeys()){ - if(!other.containsKey(key) || other.get(key).trim().isEmpty()){ + if(other.get(key) == null || other.get(key).trim().isEmpty()){ other.put(key, base.get(key)); added++; Log.info("&lc- Adding missing key '@'...", key); @@ -73,7 +73,9 @@ public class BundleLauncher{ StringBuilder result = new StringBuilder(); //add everything ordered - for(String key : base.orderedKeys().and(extras.keys().toSeq())){ + for(String key : base.orderedKeys().copy().and(extras.keys().toSeq())){ + if(other.get(key) == null) continue; + result.append(processor.get(key, other.get(key))); other.remove(key); }