| 1 | name: Release |
| 2 | on: |
| 3 | push: |
| 4 | tags: |
| 5 | - '*' |
| 6 | jobs: |
| 7 | release: |
| 8 | name: ${{ matrix.name }} |
| 9 | runs-on: ${{ matrix.os }} |
| 10 | strategy: |
| 11 | fail-fast: false |
| 12 | matrix: |
| 13 | include: |
| 14 | - name: Windows MSVC Win32 |
| 15 | os: windows-latest |
| 16 | compiler: cl |
| 17 | cmake-args: -A Win32 |
| 18 | deploy-name: win-x86 |
| 19 | |
| 20 | - name: Windows MSVC Win32 Compat |
| 21 | os: windows-latest |
| 22 | compiler: cl |
| 23 | cmake-args: -A Win32 -DZLIB_COMPAT=ON |
| 24 | deploy-name: win-x86-compat |
| 25 | |
| 26 | - name: Windows MSVC Win64 |
| 27 | os: windows-latest |
| 28 | compiler: cl |
| 29 | cmake-args: -A x64 |
| 30 | deploy-name: win-x86-64 |
| 31 | |
| 32 | - name: Windows MSVC Win64 Compat |
| 33 | os: windows-latest |
| 34 | compiler: cl |
| 35 | cmake-args: -A x64 -DZLIB_COMPAT=ON |
| 36 | deploy-name: win-x86-64-compat |
| 37 | |
| 38 | - name: Windows MSVC ARM |
| 39 | os: windows-latest |
| 40 | compiler: cl |
| 41 | cmake-args: -A ARM |
| 42 | deploy-name: win-arm |
| 43 | |
| 44 | - name: Windows MSVC ARM Compat |
| 45 | os: windows-latest |
| 46 | compiler: cl |
| 47 | cmake-args: -A ARM -DZLIB_COMPAT=ON |
| 48 | deploy-name: win-arm-compat |
| 49 | |
| 50 | - name: Windows MSVC ARM64 |
| 51 | os: windows-latest |
| 52 | compiler: cl |
| 53 | cmake-args: -A ARM64 |
| 54 | deploy-name: win-arm64 |
| 55 | |
| 56 | - name: Windows MSVC ARM64 Compat |
| 57 | os: windows-latest |
| 58 | compiler: cl |
| 59 | cmake-args: -A ARM64 -DZLIB_COMPAT=ON |
| 60 | deploy-name: win-arm64-compat |
| 61 | |
| 62 | steps: |
| 63 | - name: Checkout repository |
| 64 | uses: actions/checkout@v3 |
| 65 | |
| 66 | - name: Set environment variables |
| 67 | shell: bash |
| 68 | run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV |
| 69 | |
| 70 | - name: Generate project files |
| 71 | shell: bash |
| 72 | run: | |
| 73 | cmake . ${{ matrix.cmake-args }} \ |
| 74 | -DCMAKE_BUILD_TYPE=Release \ |
| 75 | -DZLIB_ENABLE_TESTS=ON \ |
| 76 | -DCMAKE_INSTALL_PREFIX=out \ |
| 77 | -DINSTALL_UTILS=ON |
| 78 | env: |
| 79 | CC: ${{ matrix.compiler }} |
| 80 | CI: true |
| 81 | |
| 82 | - name: Compile source code |
| 83 | run: cmake --build . --config Release --target install |
| 84 | |
| 85 | - name: Package release (Windows) |
| 86 | if: runner.os == 'Windows' |
| 87 | run: 7z a -tzip ../zlib-ng-${{ matrix.deploy-name }}.zip bin include lib ../LICENSE.md ../PORTING.md ../README.md |
| 88 | working-directory: out |
| 89 | |
| 90 | - name: Upload release (Windows) |
| 91 | uses: svenstaro/upload-release-action@v1-release |
| 92 | if: runner.os == 'Windows' |
| 93 | with: |
| 94 | asset_name: zlib-ng-${{ matrix.deploy-name }}.zip |
| 95 | file: zlib-ng-${{ matrix.deploy-name }}.zip |
| 96 | tag: ${{env.tag}} |
| 97 | repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 98 | overwrite: true |
| 99 | env: |
| 100 | GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |