+ +
b0d80ca chore(release): bump version to v0.2.2 and finalize release docs/docker
saifmukhtar · 2026-11-25
yaml · 340 lines · 11.0 KB
main
| 1 | name: Release & Multi-Platform Distribution |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | tags: |
| 6 | - 'v*' |
| 7 | workflow_dispatch: |
| 8 | |
| 9 | permissions: |
| 10 | contents: write |
| 11 | packages: write |
| 12 | |
| 13 | jobs: |
| 14 | # ---------------------------------------------------------------------------- |
| 15 | # 1. Linux Native Packages (.deb, .rpm, .tar.gz) via CMake + CTest + CPack |
| 16 | # ---------------------------------------------------------------------------- |
| 17 | build-linux-packages: |
| 18 | name: Build & Test Linux Packages (DEB, RPM, TGZ) |
| 19 | runs-on: ubuntu-22.04 |
| 20 | steps: |
| 21 | - name: Checkout Source Code |
| 22 | uses: actions/checkout@v7 |
| 23 | |
| 24 | - name: Install Build & Packaging Tools |
| 25 | run: | |
| 26 | sudo apt-get update -qq |
| 27 | sudo apt-get install -y -qq build-essential cmake rpm |
| 28 | |
| 29 | - name: Configure CMake |
| 30 | run: | |
| 31 | cmake -B build -S . \ |
| 32 | -DCMAKE_BUILD_TYPE=Release \ |
| 33 | -DCMAKE_C_EXTENSIONS=OFF \ |
| 34 | -DCMAKE_INSTALL_PREFIX=/usr \ |
| 35 | -DBUILD_TESTING=ON |
| 36 | |
| 37 | - name: Build Library, CLI & Tests |
| 38 | run: cmake --build build -j$(nproc) |
| 39 | |
| 40 | - name: Run CTest Suite |
| 41 | run: ctest --test-dir build --output-on-failure |
| 42 | |
| 43 | - name: Generate Packages |
| 44 | run: | |
| 45 | mkdir -p dist |
| 46 | cpack --config build/CPackConfig.cmake -B dist |
| 47 | rm -rf dist/_CPack_Packages |
| 48 | |
| 49 | - name: Upload Package Artifacts |
| 50 | uses: actions/upload-artifact@v7 |
| 51 | with: |
| 52 | name: linux-native-packages |
| 53 | path: dist/* |
| 54 | if-no-files-found: error |
| 55 | |
| 56 | # ---------------------------------------------------------------------------- |
| 57 | # 2. Alpine Linux musl Package (.tar.gz) via CMake + CTest + CPack |
| 58 | # ---------------------------------------------------------------------------- |
| 59 | build-alpine-musl-package: |
| 60 | name: Build & Test Alpine Linux musl Package |
| 61 | runs-on: ubuntu-22.04 |
| 62 | container: |
| 63 | image: alpine:3.20 |
| 64 | steps: |
| 65 | - name: Install Build & Packaging Tools |
| 66 | run: apk add --no-cache git build-base cmake linux-headers ffmpeg-dev |
| 67 | |
| 68 | - name: Checkout Source Code |
| 69 | uses: actions/checkout@v7 |
| 70 | |
| 71 | - name: Configure CMake |
| 72 | run: | |
| 73 | cmake -B build -S . \ |
| 74 | -DCMAKE_BUILD_TYPE=Release \ |
| 75 | -DCMAKE_C_EXTENSIONS=OFF \ |
| 76 | -DCMAKE_INSTALL_PREFIX=/usr \ |
| 77 | -DBUILD_TESTING=ON |
| 78 | |
| 79 | - name: Build Library, CLI & Tests |
| 80 | run: cmake --build build -j$(nproc) |
| 81 | |
| 82 | - name: Run CTest Suite |
| 83 | run: ctest --test-dir build --output-on-failure |
| 84 | |
| 85 | - name: Generate musl Tarball Package |
| 86 | run: | |
| 87 | mkdir -p dist |
| 88 | VERSION=$(grep 'PROJECT_VERSION:STATIC=' build/CMakeCache.txt | cut -d= -f2) |
| 89 | cpack --config build/CPackConfig.cmake -G "TGZ" -D CPACK_PACKAGE_FILE_NAME="openavx-${VERSION}-linux-x86_64-musl" -B dist |
| 90 | rm -rf dist/_CPack_Packages |
| 91 | |
| 92 | - name: Upload musl Package Artifacts |
| 93 | uses: actions/upload-artifact@v7 |
| 94 | with: |
| 95 | name: alpine-musl-package |
| 96 | path: dist/* |
| 97 | if-no-files-found: error |
| 98 | |
| 99 | # ---------------------------------------------------------------------------- |
| 100 | # 3. macOS Universal 2 Package (arm64 + x86_64) |
| 101 | # ---------------------------------------------------------------------------- |
| 102 | build-macos: |
| 103 | name: Build & Test macOS Universal 2 Package |
| 104 | runs-on: macos-15 |
| 105 | steps: |
| 106 | - name: Checkout Source Code |
| 107 | uses: actions/checkout@v7 |
| 108 | |
| 109 | - name: Configure Universal 2 Build |
| 110 | run: | |
| 111 | cmake -B build-macos -S . \ |
| 112 | -DCMAKE_BUILD_TYPE=Release \ |
| 113 | -DCMAKE_C_EXTENSIONS=OFF \ |
| 114 | -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ |
| 115 | -DCMAKE_INSTALL_PREFIX=/usr/local \ |
| 116 | -DBUILD_TESTING=ON |
| 117 | |
| 118 | - name: Compile Universal Binaries & Tests |
| 119 | run: cmake --build build-macos -j$(sysctl -n hw.ncpu) |
| 120 | |
| 121 | - name: Run CTest Suite |
| 122 | run: ctest --test-dir build-macos --output-on-failure |
| 123 | |
| 124 | - name: Package macOS Tarball |
| 125 | run: | |
| 126 | mkdir -p dist |
| 127 | cpack --config build-macos/CPackConfig.cmake -G "TGZ" -B dist |
| 128 | rm -rf dist/_CPack_Packages |
| 129 | |
| 130 | - name: Upload macOS Artifacts |
| 131 | uses: actions/upload-artifact@v7 |
| 132 | with: |
| 133 | name: macos-packages |
| 134 | path: dist/* |
| 135 | if-no-files-found: error |
| 136 | |
| 137 | # ---------------------------------------------------------------------------- |
| 138 | # 4. Windows Native Package (x64 ZIP) |
| 139 | # ---------------------------------------------------------------------------- |
| 140 | build-windows: |
| 141 | name: Build & Test Windows Package (x64) |
| 142 | runs-on: windows-2025 |
| 143 | steps: |
| 144 | - name: Checkout Source Code |
| 145 | uses: actions/checkout@v7 |
| 146 | |
| 147 | - name: Configure CMake |
| 148 | run: cmake -B build-win -S . -A x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_EXTENSIONS=OFF -DBUILD_TESTING=ON |
| 149 | |
| 150 | - name: Build Solution & Tests |
| 151 | run: cmake --build build-win --config Release -j4 |
| 152 | |
| 153 | - name: Run CTest Suite |
| 154 | run: ctest --test-dir build-win -C Release --output-on-failure |
| 155 | |
| 156 | - name: Package Windows ZIP |
| 157 | run: | |
| 158 | mkdir dist |
| 159 | cpack --config build-win/CPackConfig.cmake -C Release -G "ZIP" -B dist |
| 160 | if (Test-Path dist/_CPack_Packages) { Remove-Item -Recurse -Force dist/_CPack_Packages } |
| 161 | |
| 162 | - name: Upload Windows Artifacts |
| 163 | uses: actions/upload-artifact@v7 |
| 164 | with: |
| 165 | name: windows-packages |
| 166 | path: dist/* |
| 167 | if-no-files-found: error |
| 168 | |
| 169 | # ---------------------------------------------------------------------------- |
| 170 | # 5. Multi-Arch Docker Container Build (Native x86_64 & ARM64) & Push to GHCR |
| 171 | # ---------------------------------------------------------------------------- |
| 172 | build-docker: |
| 173 | name: Build Docker Container (${{ matrix.arch }}) |
| 174 | strategy: |
| 175 | fail-fast: false |
| 176 | matrix: |
| 177 | include: |
| 178 | - platform: linux/amd64 |
| 179 | runner: ubuntu-22.04 |
| 180 | arch: amd64 |
| 181 | - platform: linux/arm64 |
| 182 | runner: ubuntu-22.04-arm |
| 183 | arch: arm64 |
| 184 | runs-on: ${{ matrix.runner }} |
| 185 | steps: |
| 186 | - name: Checkout Source Code |
| 187 | uses: actions/checkout@v7 |
| 188 | |
| 189 | - name: Set up Docker Buildx |
| 190 | uses: docker/setup-buildx-action@v4 |
| 191 | |
| 192 | - name: Log in to GitHub Container Registry |
| 193 | if: startsWith(github.ref, 'refs/tags/v') |
| 194 | uses: docker/login-action@v4 |
| 195 | with: |
| 196 | registry: ghcr.io |
| 197 | username: ${{ github.actor }} |
| 198 | password: ${{ secrets.GITHUB_TOKEN }} |
| 199 | |
| 200 | - name: Extract Docker Metadata |
| 201 | id: meta |
| 202 | uses: docker/metadata-action@v5 |
| 203 | with: |
| 204 | images: ghcr.io/${{ github.repository }} |
| 205 | tags: | |
| 206 | type=semver,pattern={{version}} |
| 207 | type=semver,pattern={{major}}.{{minor}} |
| 208 | type=raw,value=latest,enable={{is_default_branch}} |
| 209 | |
| 210 | - name: Build and Test Alpine Container (PR / Dispatch) |
| 211 | if: "!startsWith(github.ref, 'refs/tags/v')" |
| 212 | uses: docker/build-push-action@v7 |
| 213 | with: |
| 214 | context: . |
| 215 | file: distribution/docker/Dockerfile |
| 216 | platforms: ${{ matrix.platform }} |
| 217 | push: false |
| 218 | labels: ${{ steps.meta.outputs.labels }} |
| 219 | |
| 220 | - name: Build and Push Digest to GHCR (Release Tag) |
| 221 | id: build |
| 222 | if: startsWith(github.ref, 'refs/tags/v') |
| 223 | uses: docker/build-push-action@v7 |
| 224 | with: |
| 225 | context: . |
| 226 | file: distribution/docker/Dockerfile |
| 227 | platforms: ${{ matrix.platform }} |
| 228 | labels: ${{ steps.meta.outputs.labels }} |
| 229 | outputs: type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true |
| 230 | |
| 231 | - name: Export Image Digest |
| 232 | if: startsWith(github.ref, 'refs/tags/v') |
| 233 | run: | |
| 234 | mkdir -p /tmp/digests |
| 235 | digest="${{ steps.build.outputs.digest }}" |
| 236 | echo -n "${digest}" > "/tmp/digests/${digest#sha256:}" |
| 237 | |
| 238 | - name: Upload Digest Artifact |
| 239 | if: startsWith(github.ref, 'refs/tags/v') |
| 240 | uses: actions/upload-artifact@v7 |
| 241 | with: |
| 242 | name: docker-digests-${{ matrix.arch }} |
| 243 | path: /tmp/digests/* |
| 244 | if-no-files-found: error |
| 245 | |
| 246 | merge-docker-manifest: |
| 247 | name: Merge Multi-Arch Docker Manifest |
| 248 | needs: build-docker |
| 249 | if: startsWith(github.ref, 'refs/tags/v') |
| 250 | runs-on: ubuntu-22.04 |
| 251 | steps: |
| 252 | - name: Set up Docker Buildx |
| 253 | uses: docker/setup-buildx-action@v4 |
| 254 | |
| 255 | - name: Log in to GitHub Container Registry |
| 256 | uses: docker/login-action@v4 |
| 257 | with: |
| 258 | registry: ghcr.io |
| 259 | username: ${{ github.actor }} |
| 260 | password: ${{ secrets.GITHUB_TOKEN }} |
| 261 | |
| 262 | - name: Extract Docker Metadata |
| 263 | id: meta |
| 264 | uses: docker/metadata-action@v5 |
| 265 | with: |
| 266 | images: ghcr.io/${{ github.repository }} |
| 267 | tags: | |
| 268 | type=semver,pattern={{version}} |
| 269 | type=semver,pattern={{major}}.{{minor}} |
| 270 | type=raw,value=latest,enable={{is_default_branch}} |
| 271 | |
| 272 | - name: Download Image Digests |
| 273 | uses: actions/download-artifact@v7 |
| 274 | with: |
| 275 | pattern: docker-digests-* |
| 276 | path: /tmp/digests |
| 277 | merge-multiple: true |
| 278 | |
| 279 | - name: Create Multi-Arch Manifest List |
| 280 | working-directory: /tmp/digests |
| 281 | run: | |
| 282 | IMAGE_NAME=$(echo "ghcr.io/${{ github.repository }}" | tr '[:upper:]' '[:lower:]') |
| 283 | TAG_ARGS="" |
| 284 | while IFS= read -r tag; do |
| 285 | [ -n "$tag" ] && TAG_ARGS="${TAG_ARGS} -t ${tag}" |
| 286 | done <<< "${{ steps.meta.outputs.tags }}" |
| 287 | DIGEST_ARGS="" |
| 288 | for f in *; do |
| 289 | DIGEST_ARGS="${DIGEST_ARGS} ${IMAGE_NAME}@sha256:${f}" |
| 290 | done |
| 291 | docker buildx imagetools create ${TAG_ARGS} ${DIGEST_ARGS} |
| 292 | |
| 293 | # ---------------------------------------------------------------------------- |
| 294 | # 6. Publish GitHub Release with Cross-Platform Checksums |
| 295 | # ---------------------------------------------------------------------------- |
| 296 | publish-release: |
| 297 | name: Publish Release & Universal Assets |
| 298 | needs: [build-linux-packages, build-alpine-musl-package, build-macos, build-windows, merge-docker-manifest] |
| 299 | if: startsWith(github.ref, 'refs/tags/v') |
| 300 | runs-on: ubuntu-22.04 |
| 301 | steps: |
| 302 | - name: Checkout Source Code |
| 303 | uses: actions/checkout@v7 |
| 304 | |
| 305 | - name: Download Linux Packages |
| 306 | uses: actions/download-artifact@v7 |
| 307 | with: |
| 308 | name: linux-native-packages |
| 309 | path: release-assets/ |
| 310 | |
| 311 | - name: Download Alpine musl Packages |
| 312 | uses: actions/download-artifact@v7 |
| 313 | with: |
| 314 | name: alpine-musl-package |
| 315 | path: release-assets/ |
| 316 | |
| 317 | - name: Download macOS Packages |
| 318 | uses: actions/download-artifact@v7 |
| 319 | with: |
| 320 | name: macos-packages |
| 321 | path: release-assets/ |
| 322 | |
| 323 | - name: Download Windows Packages |
| 324 | uses: actions/download-artifact@v7 |
| 325 | with: |
| 326 | name: windows-packages |
| 327 | path: release-assets/ |
| 328 | |
| 329 | - name: Generate SHA-256 Checksums |
| 330 | working-directory: release-assets |
| 331 | run: | |
| 332 | sha256sum * > SHA256SUMS |
| 333 | cat SHA256SUMS |
| 334 | |
| 335 | - name: Create GitHub Release |
| 336 | uses: softprops/action-gh-release@v2 |
| 337 | with: |
| 338 | files: release-assets/* |
| 339 | generate_release_notes: true |
| 340 | name: OpenAVX ${{ github.ref_name }} |