Make definition of ci and projects dynamic #122
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: Java CI with Gradle | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
define-versions: | |
runs-on: ubuntu-latest | |
outputs: | |
versions: ${{ steps.versions.outputs.versions }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Define Versions | |
id: versions | |
run: | | |
# ls all files from "mc" directory | |
echo "::set-output name=versions::$(ls mc)" | |
build: | |
needs: define-versions | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ${{ fromJSON(needs.define-versions.outputs.versions) }} | |
name: Build ${{ matrix.version }} | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Generate ${{ matrix.version }} | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: :${{ matrix.version }}:runServer | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: data-${{ matrix.version }} | |
path: ${{ matrix.version }}/run/server/minecraft-data | |
if-no-files-found: error |