summaryrefslogtreecommitdiff
path: root/.github/workflows/neozip-release.yml
blob: 3d115530807a24d35891e5d266f433702de4a74c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: "neozip: Release"

on:
  workflow_dispatch:
  workflow_call:

defaults:
  run:
    working-directory: neozip

jobs:
  release:
    name: ${{ matrix.name }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - name: Windows MSVC Win32
            os: windows-latest
            compiler: cl
            cmake-args: -A Win32
            deploy-name: win-x86

          - name: Windows MSVC Win32 Compat
            os: windows-latest
            compiler: cl
            cmake-args: -A Win32 -DZLIB_COMPAT=ON
            deploy-name: win-x86-compat

          - name: Windows MSVC Win64
            os: windows-latest
            compiler: cl
            cmake-args: -A x64
            deploy-name: win-x86-64

          - name: Windows MSVC Win64 Compat
            os: windows-latest
            compiler: cl
            cmake-args: -A x64 -DZLIB_COMPAT=ON
            deploy-name: win-x86-64-compat

          - name: Windows MSVC ARM
            os: windows-latest
            compiler: cl
            cmake-args: -A ARM,version=10.0.22621.0
            deploy-name: win-arm

          - name: Windows MSVC ARM Compat
            os: windows-latest
            compiler: cl
            cmake-args: -A ARM,version=10.0.22621.0 -DZLIB_COMPAT=ON
            deploy-name: win-arm-compat

          - name: Windows MSVC ARM64
            os: windows-latest
            compiler: cl
            cmake-args: -A ARM64
            deploy-name: win-arm64

          - name: Windows MSVC ARM64 Compat
            os: windows-latest
            compiler: cl
            cmake-args: -A ARM64 -DZLIB_COMPAT=ON
            deploy-name: win-arm64-compat

          - name: Windows MSVC ARM64EC
            os: windows-latest
            compiler: cl
            cmake-args: -A ARM64EC
            deploy-name: win-arm64ec

          - name: Windows MSVC ARM64EC Compat
            os: windows-latest
            compiler: cl
            cmake-args: -A ARM64EC -DZLIB_COMPAT=ON
            deploy-name: win-arm64ec-compat

    steps:
    - name: Checkout repository
      uses: actions/checkout@v6
      with:
        show-progress: 'false'

    - name: Set environment variables
      shell: bash
      run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_ENV"

    - name: Install Windows 11 SDK (ARM)
      if: matrix.name == 'Windows MSVC ARM' || matrix.name == 'Windows MSVC ARM Compat'
      run: |
        # Windows 11 SDK (10.0.22621.2428)
        # https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/index-legacy
        Invoke-WebRequest -Method Get -Uri https://go.microsoft.com/fwlink/p/?LinkId=2250105 -OutFile sdksetup.exe -UseBasicParsing
        Unblock-File sdksetup.exe
        Start-Process -Wait sdksetup.exe -ArgumentList "/q", "/norestart", "/ceip off"

    - name: Generate project files
      shell: bash
      run: |
        cmake . ${{ matrix.cmake-args }} \
          -DCMAKE_BUILD_TYPE=Release \
          -DZLIB_ENABLE_TESTS=ON \
          -DCMAKE_INSTALL_PREFIX=out \
          -DINSTALL_UTILS=ON
      env:
        CC: ${{ matrix.compiler }}
        CI: true

    - name: Compile source code
      run: cmake --build . -j5 --config Release --target install

    - name: Package release (Windows)
      if: runner.os == 'Windows'
      working-directory: neozip/out
      run: 7z a -tzip ../zlib-ng-${{ matrix.deploy-name }}.zip bin include lib ../LICENSE.md ../PORTING.md ../README.md

    - name: Upload release (Windows)
      uses: svenstaro/upload-release-action@v2
      if: runner.os == 'Windows'
      with:
        asset_name: zlib-ng-${{ matrix.deploy-name }}.zip
        file: neozip/zlib-ng-${{ matrix.deploy-name }}.zip
        tag: ${{ env.tag }}
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        overwrite: true
      env:
        GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

  source_and_upload:
    name: Source Archives
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Set version
        run: echo "VERSION=${{ github.ref_name }}" >> "$GITHUB_ENV"
        working-directory: .

      - name: Prepare source tree
        id: prepare
        working-directory: .
        run: |
          set -euo pipefail
          SRC_STAGE="source-stage"
          mkdir -p "$SRC_STAGE"
          cp -a neozip "$SRC_STAGE/neozip"
          echo "source-dir=$SRC_STAGE/neozip" >> "$GITHUB_OUTPUT"

      - name: Package source archives
        uses: ./.github/actions/package-source
        with:
          project: neozip
          version: ${{ env.VERSION }}
          source-dir: ${{ steps.prepare.outputs.source-dir }}
          output-dir: release-artifacts
          gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
          gpg-private-key-id: ${{ secrets.GPG_PRIVATE_KEY_ID }}

      - name: Upload source archives to release
        uses: softprops/action-gh-release@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          tag_name: ${{ github.ref }}
          draft: false
          fail_on_unmatched_files: false
          files: release-artifacts/*