|
| 1 | +name: Build and Package |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Build |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout Repository |
| 15 | + uses: actions/checkout@v3 |
| 16 | + with: |
| 17 | + fetch-depth: 0 |
| 18 | + - name: Set up JDK |
| 19 | + uses: actions/setup-java@v3 |
| 20 | + with: |
| 21 | + java-version: '11' |
| 22 | + distribution: 'temurin' |
| 23 | + cache: maven |
| 24 | + - name: Build |
| 25 | + run: mvn -B install --file pom.xml |
| 26 | + - name: Generate Code Coverage Report |
| 27 | + run: mvn -B jacoco:report -Dcode-coverage-format=xml --file pom.xml |
| 28 | + - name: Upload Build |
| 29 | + uses: actions/upload-artifact@v3 |
| 30 | + with: |
| 31 | + name: build |
| 32 | + path: target/Digital.zip |
| 33 | + - name: Upload Docs |
| 34 | + uses: actions/upload-artifact@v3 |
| 35 | + with: |
| 36 | + name: docs |
| 37 | + path: target/docuDist/Doc_*.pdf |
| 38 | +# - name: Setup tmate session |
| 39 | +# uses: mxschmitt/action-tmate@v3 |
| 40 | +# with: |
| 41 | +# limit-access-to-actor: true |
| 42 | + macos-dmg: |
| 43 | + name: Create macOS DMG |
| 44 | + needs: build |
| 45 | + runs-on: macos-latest |
| 46 | + steps: |
| 47 | + - name: Set up JDK |
| 48 | + uses: actions/setup-java@v3 |
| 49 | + with: |
| 50 | + java-version: '11' |
| 51 | + distribution: 'temurin' |
| 52 | + - name: Install svg2png |
| 53 | + run: brew install --formula svg2png |
| 54 | + - name: Download Build Artifacts |
| 55 | + uses: actions/download-artifact@v3 |
| 56 | + with: |
| 57 | + name: build |
| 58 | + - name: Unzip Build Artifacts |
| 59 | + run: unzip Digital.zip |
| 60 | + # Derived from https://github.com/magnusviri/svg2icns/blob/main/svg2icns |
| 61 | + - name: Create ICNS File |
| 62 | + run: | |
| 63 | + ICONSET="icon.iconset" |
| 64 | +
|
| 65 | + SMALL_SIZES=" |
| 66 | + 16,16x16 |
| 67 | + 32,16x16@2x |
| 68 | + 32,32x32 |
| 69 | + 64,32x32@2x |
| 70 | + " |
| 71 | + |
| 72 | + SIZES=" |
| 73 | + 128,128x128 |
| 74 | + 256,128x128@2x |
| 75 | + 256,256x256 |
| 76 | + 512,256x256@2x |
| 77 | + 512,512x512 |
| 78 | + 1024,512x512@2x |
| 79 | + " |
| 80 | +
|
| 81 | + mkdir -p "$ICONSET" |
| 82 | + |
| 83 | + for PARAMS in $SMALL_SIZES; do |
| 84 | + SIZE=$(echo $PARAMS | cut -d, -f1) |
| 85 | + LABEL=$(echo $PARAMS | cut -d, -f2) |
| 86 | + svg2png -w "$SIZE" -h "$SIZE" Digital/iconSmall.svg "$ICONSET/icon_$LABEL.png" |
| 87 | + done |
| 88 | + |
| 89 | + for PARAMS in $SIZES; do |
| 90 | + SIZE=$(echo $PARAMS | cut -d, -f1) |
| 91 | + LABEL=$(echo $PARAMS | cut -d, -f2) |
| 92 | + svg2png -w "$SIZE" -h "$SIZE" Digital/icon.svg "$ICONSET/icon_$LABEL.png" |
| 93 | + done |
| 94 | + |
| 95 | + iconutil -c icns "$ICONSET" |
| 96 | + - name: Build DMG |
| 97 | + run: | |
| 98 | + jpackage \ |
| 99 | + --type dmg \ |
| 100 | + --input Digital \ |
| 101 | + --main-jar Digital.jar \ |
| 102 | + --name Digital \ |
| 103 | + --description 'A digital logic designer and circuit simulator.' \ |
| 104 | + --vendor 'Helmut Neemann' \ |
| 105 | + --app-version "$(sed -n -E 's/^Build Git Version: *v([.0-9]*)-.*$/\1/p' Digital/Version.txt)" \ |
| 106 | + --copyright 'TODO' \ |
| 107 | + --icon icon.icns \ |
| 108 | + --mac-package-identifier 'de.neemann.digital' \ |
| 109 | + --mac-package-name Digital |
| 110 | + - name: Upload DMG |
| 111 | + uses: actions/upload-artifact@v3 |
| 112 | + with: |
| 113 | + name: dmg |
| 114 | + path: Digital-*.dmg |
| 115 | +# - name: Setup tmate session |
| 116 | +# uses: mxschmitt/action-tmate@v3 |
| 117 | +# with: |
| 118 | +# limit-access-to-actor: true |
0 commit comments