Skip to content

Commit

Permalink
Update workflow to handle multiple subprojects
Browse files Browse the repository at this point in the history
Added a new matrix configuration for subprojects and implemented conditional publishing depending on subproject existence. This ensures builds are executed dynamically based on available subprojects.
  • Loading branch information
ThePandaOliver committed Aug 23, 2024
1 parent 117b604 commit 026cc82
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
strategy:
matrix:
minecraft-version: [ "1.19.2", "1.20", "1.20.5", "1.21" ]
subproject: [":common", ":fabric", ":forge", "neoforge"]

permissions:
contents: read
Expand All @@ -33,7 +34,14 @@ jobs:
run: chmod +x ./gradlew

- name: Publish to GitHub Packages
run: ./gradlew -PminecraftVersion=${{ matrix.minecraft-version }} publish
# run: ./gradlew -PminecraftVersion=${{ matrix.minecraft-version }} ${{ matrix.subproject }}:publish
run: |
if ./gradlew -q projects | grep -q "${{ matrix.subproject }}"; then
echo "Running ${matrix.subproject}:publish for Minecraft version ${matrix.minecraft-version}"
./gradlew ${{ matrix.subproject }}:publish -PminecraftVersion=${{ matrix.minecraft-version }}
else
echo "Skipped ${matrix.subproject} as it does not exist"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
Expand Down

0 comments on commit 026cc82

Please sign in to comment.