|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v[0-9]+.*' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + # ── Linux x86_64 (native) ────────────────────────────────────────── |
| 13 | + linux-x86_64: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Install Rust |
| 19 | + uses: dtolnay/rust-toolchain@stable |
| 20 | + with: |
| 21 | + targets: x86_64-unknown-linux-gnu |
| 22 | + |
| 23 | + - name: Build |
| 24 | + run: cargo build --release --target x86_64-unknown-linux-gnu |
| 25 | + |
| 26 | + - name: Strip & compress |
| 27 | + run: | |
| 28 | + strip target/x86_64-unknown-linux-gnu/release/ulpExtractor |
| 29 | + tar -czf ulpExtractor-linux-x86_64.tar.gz \ |
| 30 | + -C target/x86_64-unknown-linux-gnu/release ulpExtractor \ |
| 31 | + -C "${{ github.workspace }}" README.md |
| 32 | +
|
| 33 | + - name: Upload artifact |
| 34 | + uses: actions/upload-artifact@v4 |
| 35 | + with: |
| 36 | + name: linux-x86_64 |
| 37 | + path: ulpExtractor-linux-x86_64.tar.gz |
| 38 | + if-no-files-found: error |
| 39 | + |
| 40 | + # ── Linux ARM64 (cross-compile) ──────────────────────────────────── |
| 41 | + linux-aarch64: |
| 42 | + runs-on: ubuntu-latest |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v4 |
| 45 | + |
| 46 | + - name: Install Rust |
| 47 | + uses: dtolnay/rust-toolchain@stable |
| 48 | + with: |
| 49 | + targets: aarch64-unknown-linux-gnu |
| 50 | + |
| 51 | + - name: Install cross-compiler |
| 52 | + run: | |
| 53 | + sudo apt-get update -y |
| 54 | + sudo apt-get install -y gcc-aarch64-linux-gnu |
| 55 | +
|
| 56 | + - name: Build |
| 57 | + env: |
| 58 | + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc |
| 59 | + run: cargo build --release --target aarch64-unknown-linux-gnu |
| 60 | + |
| 61 | + - name: Strip & compress |
| 62 | + run: | |
| 63 | + aarch64-linux-gnu-strip target/aarch64-unknown-linux-gnu/release/ulpExtractor |
| 64 | + tar -czf ulpExtractor-linux-aarch64.tar.gz \ |
| 65 | + -C target/aarch64-unknown-linux-gnu/release ulpExtractor \ |
| 66 | + -C "${{ github.workspace }}" README.md |
| 67 | +
|
| 68 | + - name: Upload artifact |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: linux-aarch64 |
| 72 | + path: ulpExtractor-linux-aarch64.tar.gz |
| 73 | + if-no-files-found: error |
| 74 | + |
| 75 | + # ── macOS (universal: x86_64 + ARM64) ───────────────────────────── |
| 76 | + macos: |
| 77 | + runs-on: macos-latest |
| 78 | + strategy: |
| 79 | + matrix: |
| 80 | + target: |
| 81 | + - x86_64-apple-darwin |
| 82 | + - aarch64-apple-darwin |
| 83 | + steps: |
| 84 | + - uses: actions/checkout@v4 |
| 85 | + |
| 86 | + - name: Install Rust |
| 87 | + uses: dtolnay/rust-toolchain@stable |
| 88 | + with: |
| 89 | + targets: ${{ matrix.target }} |
| 90 | + |
| 91 | + - name: Build |
| 92 | + run: cargo build --release --target ${{ matrix.target }} |
| 93 | + |
| 94 | + - name: Upload single arch |
| 95 | + uses: actions/upload-artifact@v4 |
| 96 | + with: |
| 97 | + name: macos-${{ matrix.target }} |
| 98 | + path: target/${{ matrix.target }}/release/ulpExtractor |
| 99 | + if-no-files-found: error |
| 100 | + |
| 101 | + # ── macOS: package both arches together ──────────────────────────── |
| 102 | + macos-bundle: |
| 103 | + needs: macos |
| 104 | + runs-on: macos-latest |
| 105 | + steps: |
| 106 | + - uses: actions/download-artifact@v4 |
| 107 | + with: |
| 108 | + pattern: macos-* |
| 109 | + merge-multiple: true |
| 110 | + path: bins |
| 111 | + |
| 112 | + - name: Create universal binary (if both exist) |
| 113 | + run: | |
| 114 | + set -e |
| 115 | + chmod +x bins/ulpExtractor || true |
| 116 | + if [ -f bins/x86_64-apple-darwin/ulpExtractor ] && [ -f bins/aarch64-apple-darwin/ulpExtractor ]; then |
| 117 | + mkdir -p bins |
| 118 | + lipo -create \ |
| 119 | + bins/x86_64-apple-darwin/ulpExtractor \ |
| 120 | + bins/aarch64-apple-darwin/ulpExtractor \ |
| 121 | + -output bins/ulpExtractor |
| 122 | + elif [ -f bins/ulpExtractor ]; then |
| 123 | + cp bins/ulpExtractor bins/ulpExtractor-fat |
| 124 | + mv bins/ulpExtractor-fat bins/ulpExtractor |
| 125 | + fi |
| 126 | +
|
| 127 | + - name: Package |
| 128 | + run: tar -czf ulpExtractor-macos.tar.gz -C bins . |
| 129 | + |
| 130 | + - name: Upload |
| 131 | + uses: actions/upload-artifact@v4 |
| 132 | + with: |
| 133 | + name: macos |
| 134 | + path: ulpExtractor-macos.tar.gz |
| 135 | + if-no-files-found: error |
| 136 | + |
| 137 | + # ── Windows x86_64 ───────────────────────────────────────────────── |
| 138 | + windows-x86_64: |
| 139 | + runs-on: windows-latest |
| 140 | + steps: |
| 141 | + - uses: actions/checkout@v4 |
| 142 | + |
| 143 | + - name: Install Rust |
| 144 | + uses: dtolnay/rust-toolchain@stable |
| 145 | + with: |
| 146 | + targets: x86_64-pc-windows-msvc |
| 147 | + |
| 148 | + - name: Build |
| 149 | + run: cargo build --release --target x86_64-pc-windows-msvc |
| 150 | + |
| 151 | + - name: Package |
| 152 | + shell: bash |
| 153 | + run: | |
| 154 | + 7z a ulpExtractor-windows-x86_64.zip \ |
| 155 | + target/x86_64-pc-windows-msvc/release/ulpExtractor.exe \ |
| 156 | + README.md |
| 157 | +
|
| 158 | + - name: Upload artifact |
| 159 | + uses: actions/upload-artifact@v4 |
| 160 | + with: |
| 161 | + name: windows-x86_64 |
| 162 | + path: ulpExtractor-windows-x86_64.zip |
| 163 | + if-no-files-found: error |
| 164 | + |
| 165 | + # ── GitHub Release ───────────────────────────────────────────────── |
| 166 | + release: |
| 167 | + needs: |
| 168 | + - linux-x86_64 |
| 169 | + - linux-aarch64 |
| 170 | + - macos-bundle |
| 171 | + - windows-x86_64 |
| 172 | + runs-on: ubuntu-latest |
| 173 | + steps: |
| 174 | + - uses: actions/download-artifact@v4 |
| 175 | + with: |
| 176 | + pattern: '*' |
| 177 | + merge-multiple: true |
| 178 | + path: dist |
| 179 | + |
| 180 | + - name: Checksums |
| 181 | + run: | |
| 182 | + cd dist |
| 183 | + sha256sum *.tar.gz *.zip > checksums.txt |
| 184 | +
|
| 185 | + - name: Create Release |
| 186 | + uses: softprops/action-gh-release@v2 |
| 187 | + with: |
| 188 | + name: ${{ github.ref_name }} |
| 189 | + body: | |
| 190 | + ## ${{ github.ref_name }} |
| 191 | +
|
| 192 | + Pre-built binaries for all platforms. |
| 193 | +
|
| 194 | + ### Downloads |
| 195 | +
|
| 196 | + | Platform | File | |
| 197 | + |----------|------| |
| 198 | + | Linux x86_64 | `ulpExtractor-linux-x86_64.tar.gz` | |
| 199 | + | Linux ARM64 | `ulpExtractor-linux-aarch64.tar.gz` | |
| 200 | + | macOS (Universal) | `ulpExtractor-macos.tar.gz` | |
| 201 | + | Windows x86_64 | `ulpExtractor-windows-x86_64.zip` | |
| 202 | +
|
| 203 | + ### Verify |
| 204 | +
|
| 205 | + ```bash |
| 206 | + sha256sum -c checksums.txt |
| 207 | + ``` |
| 208 | + files: | |
| 209 | + dist/ulpExtractor-linux-x86_64.tar.gz |
| 210 | + dist/ulpExtractor-linux-aarch64.tar.gz |
| 211 | + dist/ulpExtractor-macos.tar.gz |
| 212 | + dist/ulpExtractor-windows-x86_64.zip |
| 213 | + dist/checksums.txt |
| 214 | + draft: false |
| 215 | + prerelease: false |
0 commit comments