Skip to content

Commit

Permalink
ci: Automatically exclude loaders if they're not enabled yet
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Oct 23, 2024
1 parent 9f31a31 commit 3023e3a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,30 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const settingsGradle = fs.readFileSync('settings.gradle', 'utf8');
const includePattern = /^(?!\s*\/\/)\s*include\s*\(\s*["']([^"']+)["']\s*\)/gm;
const includes = [...settingsGradle.matchAll(includePattern)].map(match => match[1]);
const includeFabric = includes.includes('fabric') && ${{inputs.fabric}};
const includeForge = includes.includes('forge') && ${{inputs.forge}};
const includeNeoForge = includes.includes('neoforge') && ${{inputs.neoforge}};
return {
loader: [${{inputs.fabric}} ? 'fabric' : false, ${{inputs.forge}} ? 'forge' : false, ${{inputs.neoforge}} ? 'neoforge' : false].filter(Boolean),
loader: [includeFabric ? 'fabric' : false, includeForge ? 'forge' : false, includeNeoForge ? 'neoforge' : false].filter(Boolean),
}
- name: Preparing publish matrix
id: set-publish-matrix
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const settingsGradle = fs.readFileSync('settings.gradle', 'utf8');
const includePattern = /^(?!\s*\/\/)\s*include\s*\(\s*["']([^"']+)["']\s*\)/gm;
const includes = [...settingsGradle.matchAll(includePattern)].map(match => match[1]);
const includeFabric = includes.includes('fabric') && ${{inputs.fabric}};
const includeForge = includes.includes('forge') && ${{inputs.forge}};
const includeNeoForge = includes.includes('neoforge') && ${{inputs.neoforge}};
return {
loader: ['common', ${{inputs.fabric}} ? 'fabric' : false, ${{inputs.forge}} ? 'forge' : false, ${{inputs.neoforge}} ? 'neoforge' : false].filter(Boolean),
loader: ['common', includeFabric ? 'fabric' : false, includeForge ? 'forge' : false, includeNeoForge ? 'neoforge' : false].filter(Boolean),
site: ['curseforge', 'modrinth', 'publish'],
exclude: [
{loader: 'common', site: 'curseforge'},
Expand Down

0 comments on commit 3023e3a

Please sign in to comment.