|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build: |
| 9 | + strategy: |
| 10 | + matrix: |
| 11 | + include: |
| 12 | + - os: windows-latest |
| 13 | + target-cpu: i386 |
| 14 | + target-os: win32 |
| 15 | + artifact: DiskImageManager-win32.zip |
| 16 | + - os: windows-latest |
| 17 | + target-cpu: x86_64 |
| 18 | + target-os: win64 |
| 19 | + artifact: DiskImageManager-win64.zip |
| 20 | + - os: ubuntu-latest |
| 21 | + target-cpu: x86_64 |
| 22 | + target-os: linux |
| 23 | + artifact: DiskImageManager-linux-x64.tar.gz |
| 24 | + - os: macos-latest |
| 25 | + target-cpu: x86_64 |
| 26 | + target-os: darwin |
| 27 | + artifact: DiskImageManager-macos-x64.tar.gz |
| 28 | + |
| 29 | + runs-on: ${{ matrix.os }} |
| 30 | + |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Install Lazarus |
| 35 | + uses: gcarreno/setup-lazarus@v3 |
| 36 | + with: |
| 37 | + lazarus-version: stable |
| 38 | + |
| 39 | + - name: Build package |
| 40 | + run: lazbuild --add-package Source/DIMComponents.lpk |
| 41 | + |
| 42 | + - name: Build application |
| 43 | + run: > |
| 44 | + lazbuild |
| 45 | + --build-mode=Debug |
| 46 | + --cpu=${{ matrix.target-cpu }} |
| 47 | + --os=${{ matrix.target-os }} |
| 48 | + Source/DiskImageManager.lpi |
| 49 | +
|
| 50 | + - name: Package (Windows) |
| 51 | + if: startsWith(matrix.os, 'windows') |
| 52 | + shell: pwsh |
| 53 | + run: | |
| 54 | + $exe = Get-ChildItem -Path out -Recurse -Filter "DiskImageManager.exe" | Select-Object -First 1 |
| 55 | + Compress-Archive -Path $exe.FullName -DestinationPath ${{ matrix.artifact }} |
| 56 | +
|
| 57 | + - name: Package (Linux/macOS) |
| 58 | + if: "!startsWith(matrix.os, 'windows')" |
| 59 | + run: | |
| 60 | + binary=$(find out -name "DiskImageManager" -o -name "diskimagemanager" | head -1) |
| 61 | + chmod +x "$binary" |
| 62 | + tar czf ${{ matrix.artifact }} -C "$(dirname "$binary")" "$(basename "$binary")" |
| 63 | +
|
| 64 | + - name: Upload release asset |
| 65 | + env: |
| 66 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + run: gh release upload ${{ github.event.release.tag_name }} ${{ matrix.artifact }} |
0 commit comments