|
| 1 | +name: package-binary |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + os: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + os_version: |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + compiler: |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + triplet: |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + variant: |
| 19 | + required: true |
| 20 | + type: string |
| 21 | + |
| 22 | +jobs: |
| 23 | + package-macos: |
| 24 | + if: ${{ inputs.os == 'macos' }} |
| 25 | + strategy: |
| 26 | + fail-fast: false |
| 27 | + env: |
| 28 | + OUTPUT_BINARY: firestarr-${{ inputs.os }}-${{ inputs.target-cpu}}-${{ inputs.target-compiler }}-${{ inputs.variant }} |
| 29 | + steps: |
| 30 | + - name: Locate binary |
| 31 | + id: locate |
| 32 | + run: | |
| 33 | + # Find the built executable |
| 34 | + BINARY=$(find build -type f -name "firestarr" -perm +111 | head -1) |
| 35 | + if [ -z "$BINARY" ]; then |
| 36 | + echo "ERROR: Could not find firestarr binary" |
| 37 | + find build -type f -perm +111 |
| 38 | + exit 1 |
| 39 | + fi |
| 40 | + echo "binary=$BINARY" >> $GITHUB_OUTPUT |
| 41 | + echo "Found binary at: $BINARY" |
| 42 | +
|
| 43 | + - name: Check binary dependencies |
| 44 | + run: | |
| 45 | + echo "=== Binary info ===" |
| 46 | + file ${{ steps.locate.outputs.binary }} |
| 47 | + echo "" |
| 48 | + echo "=== Dynamic dependencies ===" |
| 49 | + otool -L ${{ steps.locate.outputs.binary }} || true |
| 50 | +
|
| 51 | + - name: Package artifact |
| 52 | + run: | |
| 53 | + mkdir -p dist |
| 54 | + cp ${{ steps.locate.outputs.binary }} dist/firestarr |
| 55 | +
|
| 56 | + # Bundle data files if they exist |
| 57 | + [ -f firestarr/fuel.lut ] && cp firestarr/fuel.lut dist/ |
| 58 | + [ -f firestarr/settings.ini ] && cp firestarr/settings.ini dist/ |
| 59 | + [ -f firestarr/data/fuel.lut ] && cp firestarr/data/fuel.lut dist/ |
| 60 | + [ -f firestarr/data/settings.ini ] && cp firestarr/data/settings.ini dist/ |
| 61 | +
|
| 62 | + # Create version info |
| 63 | + cd firestarr && git rev-parse HEAD > ../dist/VERSION && cd .. |
| 64 | +
|
| 65 | + # List contents |
| 66 | + echo "=== Package contents ===" |
| 67 | + ls -la dist/ |
| 68 | +
|
| 69 | + # Create tarball |
| 70 | + tar -czvf ${{ env.OUTPUT_BINARY }}.tar.gz -C dist . |
| 71 | +
|
| 72 | + - name: Upload artifact |
| 73 | + uses: actions/upload-artifact@v4 |
| 74 | + with: |
| 75 | + name: ${{ env.OUTPUT_BINARY }} |
| 76 | + path: ${{ env.OUTPUT_BINARY }}.tar.gz |
| 77 | + retention-days: 30 |
| 78 | + |
| 79 | + package-linux: |
| 80 | + if: ${{ inputs.os == 'linux' }} |
| 81 | + strategy: |
| 82 | + fail-fast: false |
| 83 | + env: |
| 84 | + OUTPUT_BINARY: firestarr-${{ inputs.os }}-${{ inputs.target-cpu}}-${{ inputs.target-compiler }}-${{ inputs.variant }} |
| 85 | + steps: |
| 86 | + - name: Locate binary |
| 87 | + id: locate |
| 88 | + run: | |
| 89 | + # Find the built executable |
| 90 | + BINARY=$(find build -type f -name "firestarr" -executable | head -1) |
| 91 | + if [ -z "$BINARY" ]; then |
| 92 | + echo "ERROR: Could not find firestarr binary" |
| 93 | + find build -type f -executable |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | + echo "binary=$BINARY" >> $GITHUB_OUTPUT |
| 97 | + echo "Found binary at: $BINARY" |
| 98 | +
|
| 99 | + - name: Check binary dependencies |
| 100 | + run: | |
| 101 | + echo "=== Binary info ===" |
| 102 | + file ${{ steps.locate.outputs.binary }} |
| 103 | + echo "" |
| 104 | + echo "=== Dynamic dependencies ===" |
| 105 | + ldd ${{ steps.locate.outputs.binary }} || true |
| 106 | +
|
| 107 | + - name: Package artifact |
| 108 | + run: | |
| 109 | + mkdir -p dist |
| 110 | + cp ${{ steps.locate.outputs.binary }} dist/firestarr |
| 111 | +
|
| 112 | + # Bundle data files if they exist |
| 113 | + [ -f firestarr/fuel.lut ] && cp firestarr/fuel.lut dist/ |
| 114 | + [ -f firestarr/settings.ini ] && cp firestarr/settings.ini dist/ |
| 115 | + [ -f firestarr/data/fuel.lut ] && cp firestarr/data/fuel.lut dist/ |
| 116 | + [ -f firestarr/data/settings.ini ] && cp firestarr/data/settings.ini dist/ |
| 117 | +
|
| 118 | + # Create version info |
| 119 | + cd firestarr && git rev-parse HEAD > ../dist/VERSION && cd .. |
| 120 | +
|
| 121 | + # List contents |
| 122 | + echo "=== Package contents ===" |
| 123 | + ls -la dist/ |
| 124 | +
|
| 125 | + # Create tarball |
| 126 | + tar -czvf ${{ env.OUTPUT_BINARY }}.tar.gz -C dist . |
| 127 | +
|
| 128 | + - name: Upload artifact |
| 129 | + uses: actions/upload-artifact@v4 |
| 130 | + with: |
| 131 | + name: ${{ env.OUTPUT_BINARY }} |
| 132 | + path: ${{ env.OUTPUT_BINARY }}.tar.gz |
| 133 | + retention-days: 30 |
| 134 | + |
| 135 | + |
| 136 | + package-windows: |
| 137 | + if: ${{ inputs.os == 'windows' }} |
| 138 | + strategy: |
| 139 | + fail-fast: false |
| 140 | + env: |
| 141 | + OUTPUT_BINARY: firestarr-${{ inputs.os }}-${{ inputs.target-cpu}}-${{ inputs.target-compiler }}-${{ inputs.variant }} |
| 142 | + steps: |
| 143 | + - name: Locate binary |
| 144 | + id: locate |
| 145 | + run: | |
| 146 | + $BINARY = Get-ChildItem -Path build -Recurse -Filter "firestarr.exe" | Select-Object -First 1 -ExpandProperty FullName |
| 147 | + if (-not $BINARY) { |
| 148 | + echo "ERROR: Could not find firestarr.exe" |
| 149 | + Get-ChildItem -Path build -Recurse -Filter "*.exe" | Select-Object FullName |
| 150 | + exit 1 |
| 151 | + } |
| 152 | + echo "binary=$BINARY" >> $env:GITHUB_OUTPUT |
| 153 | + echo "Found binary at: $BINARY" |
| 154 | + shell: pwsh |
| 155 | + |
| 156 | + - name: Check binary dependencies |
| 157 | + run: | |
| 158 | + echo "=== Binary info ===" |
| 159 | + Get-Item "${{ steps.locate.outputs.binary }}" | Format-List Name, Length, LastWriteTime |
| 160 | + echo "" |
| 161 | + echo "=== Binary size ===" |
| 162 | + (Get-Item "${{ steps.locate.outputs.binary }}").Length / 1MB | ForEach-Object { "{0:N2} MB" -f $_ } |
| 163 | + shell: pwsh |
| 164 | + |
| 165 | + - name: Package artifact |
| 166 | + run: | |
| 167 | + New-Item -ItemType Directory -Force -Path dist |
| 168 | +
|
| 169 | + Copy-Item "${{ steps.locate.outputs.binary }}" dist\firestarr.exe |
| 170 | +
|
| 171 | + # Copy required DLLs from vcpkg |
| 172 | + $vcpkgBin = "C:\vcpkg\installed\x64-windows\bin" |
| 173 | + if (Test-Path $vcpkgBin) { |
| 174 | + Get-ChildItem "$vcpkgBin\*.dll" | Copy-Item -Destination dist\ |
| 175 | + } |
| 176 | +
|
| 177 | + # Bundle data files if they exist |
| 178 | + if (Test-Path firestarr\fuel.lut) { Copy-Item firestarr\fuel.lut dist\ } |
| 179 | + if (Test-Path firestarr\settings.ini) { Copy-Item firestarr\settings.ini dist\ } |
| 180 | + if (Test-Path firestarr\data\fuel.lut) { Copy-Item firestarr\data\fuel.lut dist\ } |
| 181 | + if (Test-Path firestarr\data\settings.ini) { Copy-Item firestarr\data\settings.ini dist\ } |
| 182 | +
|
| 183 | + # Create version info |
| 184 | + cd firestarr |
| 185 | + git rev-parse HEAD | Out-File -FilePath ..\dist\VERSION -Encoding utf8 |
| 186 | + cd .. |
| 187 | +
|
| 188 | + # List contents |
| 189 | + echo "=== Package contents ===" |
| 190 | + Get-ChildItem dist |
| 191 | +
|
| 192 | + # Create zip |
| 193 | + Compress-Archive -Path dist\* -DestinationPath ${{ env.OUTPUT_BINARY }}.zip |
| 194 | + shell: pwsh |
| 195 | + |
| 196 | + - name: Upload artifact |
| 197 | + uses: actions/upload-artifact@v4 |
| 198 | + with: |
| 199 | + name: ${{ env.OUTPUT_BINARY }} |
| 200 | + path: ${{ env.OUTPUT_BINARY }}.tar.gz |
| 201 | + retention-days: 30 |
0 commit comments