Main Maven build #921
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: Main Maven build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - .github/workflows/maven.yml | |
| - .github/project.yml | |
| - "**.xml" | |
| - "*.yml" | |
| - "src/**" | |
| - "ide-config" | |
| env: | |
| JAVA_VERSION: 17 | |
| JAVA_DISTRO: temurin | |
| NATIVE_JAVA_VERSION: 24 | |
| GRAALVM_DIST: graalvm-community | |
| GH_BOT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com" | |
| GH_BOT_NAME: "GitHub Action" | |
| permissions: read-all | |
| jobs: | |
| main_root: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| is_main: ${{ steps.is_main_root.outputs.is_main }} | |
| steps: | |
| - name: Echo a message | |
| id: is_main_root | |
| if: github.ref == 'refs/heads/main' && github.repository == 'ebullient/ttrpg-convert-cli' | |
| run: | | |
| echo "This is the main branch of 'ebullient/ttrpg-convert-cli'" | |
| echo "is_main=true" >> $GITHUB_OUTPUT | |
| metadata: | |
| uses: ebullient/workflows/.github/workflows/java-snap-metadata.yml@65cfcd66420f2a8032c82e84bd6688a1a64713a9 # 2.0.1 | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [main_root, metadata] | |
| outputs: | |
| cache_key: ${{ steps.data_cache.outputs.cache_key }} | |
| permissions: | |
| contents: write | |
| actions: write | |
| security-events: write | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: false | |
| - uses: ./.github/actions/data-cache | |
| id: data_cache | |
| - name: Build with Maven | |
| uses: ebullient/workflows/.github/actions/maven-build@65cfcd66420f2a8032c82e84bd6688a1a64713a9 # 2.0.1 | |
| with: | |
| artifact: ${{ needs.metadata.outputs.artifact }} | |
| version: ${{ needs.metadata.outputs.snapshot }} | |
| java-version: ${{ env.JAVA_VERSION }} | |
| java-distribution: ${{ env.JAVA_DISTRO }} | |
| - name: Push changes to files | |
| if: needs.main_root.outputs.is_main | |
| uses: ebullient/workflows/.github/actions/push-changes@65cfcd66420f2a8032c82e84bd6688a1a64713a9 # 2.0.1 | |
| with: | |
| files: "README.md README-WINDOWS.md docs" | |
| native-build: | |
| needs: [metadata, build] | |
| name: Build ${{ matrix.os }} binary | |
| runs-on: ${{ matrix.os }} | |
| concurrency: | |
| group: native-${{ matrix.os }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 3 | |
| matrix: | |
| os: [macos-15-intel, macos-latest, windows-latest, ubuntu-latest] | |
| permissions: | |
| contents: read | |
| actions: write | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| fetch-depth: 1 | |
| - uses: ./.github/actions/native-data-cache | |
| with: | |
| cache_key: ${{ needs.build.outputs.cache_key }} | |
| - name: Native build with Maven | |
| uses: ebullient/workflows/.github/actions/native-build@65cfcd66420f2a8032c82e84bd6688a1a64713a9 # 2.0.1 | |
| with: | |
| artifact: ${{ needs.metadata.outputs.artifact }} | |
| version: ${{ needs.metadata.outputs.snapshot }} | |
| native-java-version: ${{ env.NATIVE_JAVA_VERSION }} | |
| distribution: ${{ env.GRAALVM_DIST }} | |
| matrix-os: ${{ matrix.os }} | |
| snap-release: | |
| needs: [main_root, metadata, build, native-build] | |
| if: needs.main_root.outputs.is_main | |
| uses: ebullient/workflows/.github/workflows/java-snapshot.yml@65cfcd66420f2a8032c82e84bd6688a1a64713a9 # 2.0.1 | |
| permissions: | |
| contents: write | |
| with: | |
| artifact: ${{ needs.metadata.outputs.artifact }} | |
| snapshot: ${{ needs.metadata.outputs.snapshot }} | |
| secrets: inherit |