Add GitHub Actions workflow for building JARs #1
This file contains hidden or 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: Build JARs | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # utile si ton build calcule une version via tags/commits | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "21" | |
| - name: Setup Gradle cache | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Ensure gradlew is executable | |
| run: chmod +x ./gradlew | |
| - name: Build | |
| run: ./gradlew --no-daemon clean build -x test | |
| - name: Collect jars | |
| run: | | |
| mkdir -p artifacts | |
| find . -path "*/build/libs/*.jar" \ | |
| ! -name "*-sources.jar" \ | |
| ! -name "*-javadoc.jar" \ | |
| -exec cp {} artifacts/ \; | |
| ls -lah artifacts | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jars-${{ github.sha }} | |
| path: artifacts/*.jar | |
| if-no-files-found: error | |
| retention-days: 14 |