ci: make build.yml reusable so publish.yml can call it #6
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 | |
| on: | |
| workflow_call: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: build-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build and verify publications | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Validate Gradle wrapper | |
| uses: gradle/actions/wrapper-validation@v4 | |
| - name: Set up Java | |
| uses: actions/setup-java@v5.6.0 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| cache: gradle | |
| # Foojay (applied in settings.gradle.kts) fetches whichever per-task | |
| # toolchains the build needs (8, 25); auto-download is already on by | |
| # default in gradle.properties, JAVA_HOME just runs the daemon. | |
| - name: Build and test | |
| run: ./gradlew build "-Dorg.gradle.java.home=$JAVA_HOME" --no-daemon --stacktrace | |
| - name: Publish to Maven Local | |
| run: ./gradlew publishToMavenLocal "-Dorg.gradle.java.home=$JAVA_HOME" --no-daemon --stacktrace |