|
| 1 | +name: Build & Deploy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + workflow_dispatch: {} |
| 11 | + |
| 12 | +# cancel superseded runs on the same branch/PR to save CI minutes. |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + |
| 20 | +jobs: |
| 21 | + |
| 22 | + build: |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + os: [ubuntu-latest, windows-latest] |
| 27 | + java: ['17'] |
| 28 | + include: |
| 29 | + - os: ubuntu-latest |
| 30 | + java: '25' |
| 31 | + runs-on: ${{ matrix.os }} |
| 32 | + # JDK 25 is a forward-compatibility canary (see errorprone-fatal profile notes in pom.xml |
| 33 | + # on Error Prone's JDK ceiling): let it fail without failing the workflow or blocking deploy. |
| 34 | + continue-on-error: ${{ matrix.java == '25' }} |
| 35 | + steps: |
| 36 | + - name: Check out repository (incl. font submodules) |
| 37 | + uses: actions/checkout@v7 |
| 38 | + with: |
| 39 | + submodules: recursive |
| 40 | + fetch-depth: 1 |
| 41 | + |
| 42 | + - name: Verify font submodules were checked out |
| 43 | + shell: bash |
| 44 | + run: | |
| 45 | + set -euo pipefail |
| 46 | + for module in figlet-fonts-xero; do |
| 47 | + dir="$module/src/main/resources/fonts" |
| 48 | + count=$(find "$dir" -type f \( -name '*.flf' -o -name '*.tlf' \) 2>/dev/null | wc -l) |
| 49 | + echo "Found $count font file(s) in $dir" |
| 50 | + if [ "$count" -eq 0 ]; then |
| 51 | + echo "::error::$module has no font files. Was the git submodule checked out (submodules: recursive)?" |
| 52 | + exit 1 |
| 53 | + fi |
| 54 | + done |
| 55 | +
|
| 56 | + - name: Set up JDK ${{ matrix.java }} |
| 57 | + uses: actions/setup-java@v6 |
| 58 | + with: |
| 59 | + java-version: ${{ matrix.java }} |
| 60 | + distribution: 'temurin' |
| 61 | + cache: maven |
| 62 | + |
| 63 | + - name: Build with Maven/JDK ${{ matrix.java }} on ${{ matrix.os }} |
| 64 | + run: mvn --batch-mode --file pom.xml clean verify |
| 65 | + |
| 66 | + deploy: |
| 67 | + needs: build |
| 68 | + if: github.event_name == 'push' |
| 69 | + runs-on: ubuntu-latest |
| 70 | + permissions: |
| 71 | + contents: read |
| 72 | + packages: write |
| 73 | + steps: |
| 74 | + - name: Check out repository (incl. font submodules) |
| 75 | + uses: actions/checkout@v7 |
| 76 | + with: |
| 77 | + submodules: recursive |
| 78 | + fetch-depth: 1 |
| 79 | + |
| 80 | + - name: Set up Java for deployment to Sonatype snapshot repo |
| 81 | + uses: actions/setup-java@v6 |
| 82 | + with: |
| 83 | + java-version: '17' |
| 84 | + distribution: 'temurin' |
| 85 | + cache: maven |
| 86 | + # Sonatype Central Snapshots |
| 87 | + # must match distributionManagement/snapshotRepository/id in pom: |
| 88 | + server-id: central |
| 89 | + server-username: SONATYPE_CENTRAL_USERNAME |
| 90 | + server-password: SONATYPE_CENTRAL_PASSWORD |
| 91 | + |
| 92 | + - name: Deploy to Sonatype Central snapshot repo |
| 93 | + run: mvn --batch-mode --file pom.xml --activate-profiles fast deploy |
| 94 | + env: |
| 95 | + SONATYPE_CENTRAL_USERNAME: ${{ secrets.SONATYPE_CENTRAL_USERNAME }} |
| 96 | + SONATYPE_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }} |
| 97 | + |
0 commit comments