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