|
| 1 | +name: Build with JDK 17 on Ubuntu |
| 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 | + runs-on: ubuntu-latest |
| 24 | + steps: |
| 25 | + - name: Check out repository (incl. font submodules) |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + submodules: recursive |
| 29 | + fetch-depth: 1 |
| 30 | + |
| 31 | + - name: Verify font submodules were checked out |
| 32 | + shell: bash |
| 33 | + run: | |
| 34 | + set -euo pipefail |
| 35 | + for module in figlet-fonts-xero; do |
| 36 | + dir="$module/src/main/resources/fonts" |
| 37 | + count=$(find "$dir" -type f \( -name '*.flf' -o -name '*.tlf' \) 2>/dev/null | wc -l) |
| 38 | + echo "Found $count font file(s) in $dir" |
| 39 | + if [ "$count" -eq 0 ]; then |
| 40 | + echo "::error::$module has no font files. Was the git submodule checked out (submodules: recursive)?" |
| 41 | + exit 1 |
| 42 | + fi |
| 43 | + done |
| 44 | +
|
| 45 | + - name: Set up JDK 17 |
| 46 | + uses: actions/setup-java@v4 |
| 47 | + with: |
| 48 | + java-version: '17' |
| 49 | + distribution: 'temurin' |
| 50 | + cache: maven |
| 51 | + |
| 52 | + - name: Build with Maven/JDK 17 on Ubuntu |
| 53 | + run: mvn --batch-mode --file pom.xml clean package |
| 54 | + |
| 55 | + deploy: |
| 56 | + needs: build |
| 57 | + runs-on: ubuntu-latest |
| 58 | + permissions: |
| 59 | + contents: read |
| 60 | + packages: write |
| 61 | + steps: |
| 62 | + - name: Check out repository (incl. font submodules) |
| 63 | + uses: actions/checkout@v4 |
| 64 | + with: |
| 65 | + submodules: recursive |
| 66 | + fetch-depth: 1 |
| 67 | + |
| 68 | + - name: Set up Java for deployment to Sonatype snapshot repo |
| 69 | + uses: actions/setup-java@v4 |
| 70 | + with: |
| 71 | + java-version: '17' |
| 72 | + distribution: 'temurin' |
| 73 | + cache: maven |
| 74 | + # Sonatype Central Snapshots |
| 75 | + # must match distributionManagement/snapshotRepository/id in pom: |
| 76 | + server-id: central |
| 77 | + server-username: SONATYPE_CENTRAL_USERNAME |
| 78 | + server-password: SONATYPE_CENTRAL_PASSWORD |
| 79 | + |
| 80 | + - name: Deploy to Sonatype Central snapshot repo |
| 81 | + run: mvn --batch-mode --file pom.xml --activate-profiles fast deploy |
| 82 | + env: |
| 83 | + SONATYPE_CENTRAL_USERNAME: ${{ secrets.SONATYPE_CENTRAL_USERNAME }} |
| 84 | + SONATYPE_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }} |
| 85 | + |
0 commit comments