1on:
2  workflow_dispatch:
3  push:
4    branches:
5    - main
6    paths:
7    - 'ChangeLog'
8
9name: release
10jobs:
11  release_windows_installer:
12    name: 'Windows ${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.platform}} (${{matrix.type}})'
13    runs-on: windows-latest
14
15    strategy:
16      fail-fast: false
17      matrix:
18        platform: [ x64, x86 ]
19        type: [ dll, static ]
20        quantum: [ Q8, Q16 ]
21        hdri: [ HDRI, noHDRI ]
22        exclude:
23          - quantum: Q8
24            hdri: HDRI
25        include:
26          - platform: x64
27            bit: 64
28            platform_alias: x64
29          - platform: x86
30            bit: 32
31            platform_alias: Win32
32          - type: dll
33            type_flag: dmt
34          - type: static
35            type_flag: smtd
36          - hdri: HDRI
37            hdri_flag: '-HDRI'
38
39    steps:
40    - uses: actions/checkout@v2
41      with:
42        repository: ImageMagick/ImageMagick-Windows
43        path: ImageMagick-Windows
44        ref: refs/heads/main
45        fetch-depth: 1
46
47    - name: Clone repositories
48      shell: cmd
49      run: |
50        cd %GITHUB_WORKSPACE%\ImageMagick-Windows
51        CloneRepositories.cmd https://github.com/ImageMagick shallow
52
53    - name: Download FFmpeg
54      shell: cmd
55      run: |
56        powershell Invoke-WebRequest -Uri https://github.com/ImageMagick/ImageMagick-Windows/releases/download/20200615/ffmpeg-4.2.3-win${{matrix.bit}}.exe -OutFile ffmpeg.exe
57        copy /Y ffmpeg.exe %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick\bin
58
59    - name: Download hp2xx
60      shell: cmd
61      run: |
62        powershell Invoke-WebRequest -Uri https://github.com/ImageMagick/ImageMagick-Windows/releases/download/20200615/hp2xx.exe -OutFile hp2xx.exe
63        copy /Y hp2xx.exe %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick\bin
64
65    - name: Install Strawberry Perl
66      if: ${{matrix.type == 'dll'}}
67      shell: cmd
68      run: |
69        powershell Invoke-WebRequest -Uri https://github.com/ImageMagick/ImageMagick-Windows/releases/download/20200615/strawberry-perl-5.30.2.1-${{matrix.bit}}bit.msi -OutFile strawberry-perl-5.30.2.1-${{matrix.bit}}bit.msi
70        msiexec /i strawberry-perl-5.30.2.1-${{matrix.bit}}bit.msi /qn INSTALLDIR="C:\Strawberry${{matrix.bit}}"
71        mv "C:\Strawberry" "C:\Strawberry64"
72
73    - name: Build configure
74      shell: cmd
75      run: |
76        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
77        cd %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick\configure
78        devenv /upgrade configure.vcxproj
79        msbuild configure.sln /m /t:Rebuild /p:Configuration=Release,Platform=Win32
80
81    - name: Configure ImageMagick
82      shell: cmd
83      run: |
84        cd %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick\configure
85        configure.exe /noWizard /VS2019 /includeOptional /installedSupport /deprecated /${{matrix.hdri}} /${{matrix.quantum}} /${{matrix.platform}} /${{matrix.type_flag}}
86
87    - name: Build ImageMagick
88      shell: cmd
89      run: |
90        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
91        cd %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick
92        set /p solution=<solution
93        msbuild %solution% /m /t:Rebuild /p:Configuration=Release,Platform=${{matrix.platform_alias}}
94
95    - name: Build PerlMagick
96      if: ${{matrix.type == 'dll'}}
97      shell: cmd
98      run: |
99        set PATH=
100        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
101        cd %GITHUB_WORKSPACE%\ImageMagick-Windows\ImageMagick\PerlMagick
102        set PATH=%PATH%;C:\Strawberry${{matrix.bit}}\c\bin;C:\Strawberry${{matrix.bit}}\perl\site\bin;C:\Strawberry${{matrix.bit}}\perl\bin;C:\WINDOWS\System32\WindowsPowerShell\v1.0
103        perl "Makefile.PL" "MAKE=nmake"
104        nmake
105        nmake release
106
107    - name: Sign binaries
108      uses: dlemstra/code-sign-action@v1
109      with:
110        certificate: '${{ secrets.CERTIFICATE }}'
111        folder: 'ImageMagick-Windows\VisualMagick\bin'
112
113    - name: Create installer
114      shell: cmd
115      run: |
116        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
117        "C:\Program Files (x86)\Inno Setup 6\iscc.exe" %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick\installer\im-${{matrix.platform}}${{matrix.hdri_flag}}-${{matrix.type}}-${{matrix.quantum}}.iss
118
119    - name: Sign installer
120      uses: dlemstra/code-sign-action@v1
121      with:
122        certificate: '${{ secrets.CERTIFICATE }}'
123        folder: 'ImageMagick-Windows\VisualMagick\installer\output'
124
125    - uses: actions/upload-artifact@v2
126      with:
127        name: installers
128        path: 'ImageMagick-Windows\VisualMagick\installer\output'
129
130  release_windows_source:
131    name: 'Windows source'
132    runs-on: windows-latest
133
134    steps:
135    - uses: actions/checkout@v2
136      with:
137        repository: ImageMagick/ImageMagick-Windows
138        path: ImageMagick-Windows
139        ref: refs/heads/main
140        fetch-depth: 1
141
142    - name: Clone repositories
143      shell: cmd
144      run: |
145        cd %GITHUB_WORKSPACE%\ImageMagick-Windows
146        CloneRepositories.cmd https://github.com/ImageMagick source
147
148    - name: Create source archive
149      shell: cmd
150      run: |
151        cd %GITHUB_WORKSPACE%\ImageMagick-Windows
152        7z a ImageMagick-Windows.7z .\source\*
153
154    - uses: actions/upload-artifact@v2
155      with:
156        name: ImageMagick-Windows
157        path: 'ImageMagick-Windows\ImageMagick-Windows.7z'
158
159  release_windows_portable:
160    name: 'Windows portable ${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.platform}}'
161    runs-on: windows-latest
162
163    strategy:
164      fail-fast: false
165      matrix:
166        platform: [ x64, x86 ]
167        quantum: [ Q8, Q16 ]
168        hdri: [ HDRI, noHDRI ]
169        exclude:
170          - quantum: Q8
171            hdri: HDRI
172        include:
173          - platform: x64
174            bit: 64
175            platform_alias: x64
176          - platform: x86
177            bit: 32
178            platform_alias: Win32
179          - hdri: HDRI
180            hdri_flag: '-HDRI'
181
182    steps:
183    - uses: actions/checkout@v2
184      with:
185        repository: ImageMagick/ImageMagick-Windows
186        path: ImageMagick-Windows
187        ref: refs/heads/main
188        fetch-depth: 1
189
190    - name: Clone repositories
191      shell: cmd
192      run: |
193        cd %GITHUB_WORKSPACE%\ImageMagick-Windows
194        CloneRepositories.cmd https://github.com/ImageMagick shallow
195
196    - name: Install FFmpeg
197      shell: cmd
198      run: |
199        powershell Invoke-WebRequest -Uri https://github.com/ImageMagick/ImageMagick-Windows/releases/download/20160630/ffmpeg-4.2-win${{matrix.bit}}.exe -OutFile ffmpeg.exe
200        copy /Y ffmpeg.exe %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick\bin
201
202    - name: Build configure
203      shell: cmd
204      run: |
205        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
206        cd %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick\configure
207        devenv /upgrade configure.vcxproj
208        msbuild configure.sln /m /t:Rebuild /p:Configuration=Release,Platform=Win32
209
210    - name: Configure ImageMagick
211      shell: cmd
212      run: |
213        cd %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick\configure
214        configure.exe /noWizard /VS2019 /noOpenMP /${{matrix.hdri}} /${{matrix.quantum}} /${{matrix.platform}} /smt
215
216    - name: Build ImageMagick
217      shell: cmd
218      run: |
219        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
220        cd %GITHUB_WORKSPACE%\ImageMagick-Windows\VisualMagick
221        set /p solution=<solution
222        msbuild %solution% /m /t:Rebuild /p:Configuration=Release,Platform=${{matrix.platform_alias}}
223
224    - name: Sign exectables
225      uses: dlemstra/code-sign-action@v1
226      with:
227        certificate: '${{ secrets.CERTIFICATE }}'
228        folder: 'ImageMagick-Windows\VisualMagick\bin'
229
230    - name: Copy Files
231      id: package
232      shell: powershell
233      run: |
234        [void](New-Item -Name "portable" -ItemType directory)
235        Copy-Item "ImageMagick-Windows\VisualMagick\bin\*.exe" "portable"
236        Copy-Item "ImageMagick-Windows\ImageMagick\config\colors.xml" "portable"
237        Copy-Item "ImageMagick-Windows\ImageMagick\config\english.xml" "portable"
238        Copy-Item "ImageMagick-Windows\ImageMagick\config\locale.xml" "portable"
239        Copy-Item "ImageMagick-Windows\ImageMagick\config\log.xml" "portable"
240        Copy-Item "ImageMagick-Windows\ImageMagick\config\mime.xml" "portable"
241        Copy-Item "ImageMagick-Windows\ImageMagick\config\quantization-table.xml" "portable"
242        Copy-Item "ImageMagick-Windows\VisualMagick\bin\configure.xml" "portable"
243        Copy-Item "ImageMagick-Windows\VisualMagick\bin\ImageMagick.rdf" "portable"
244        Copy-Item "ImageMagick-Windows\VisualMagick\bin\delegates.xml" "portable"
245        Copy-Item "ImageMagick-Windows\VisualMagick\bin\policy.xml" "portable"
246        Copy-Item "ImageMagick-Windows\VisualMagick\bin\sRGB.icc" "portable"
247        Copy-Item "ImageMagick-Windows\VisualMagick\bin\thresholds.xml" "portable"
248        Copy-Item "ImageMagick-Windows\VisualMagick\bin\type-ghostscript.xml" "portable"
249        Copy-Item "ImageMagick-Windows\VisualMagick\bin\type.xml" "portable"
250
251        Copy-Item "ImageMagick-Windows\ImageMagick\ChangeLog" "portable"
252        Copy-Item "ImageMagick-Windows\ImageMagick\LICENSE" "portable\LICENSE.txt"
253        Copy-Item "ImageMagick-Windows\VisualMagick\NOTICE.txt" "portable"
254        Copy-Item "ImageMagick-Windows\ImageMagick\README.txt" "portable"
255
256        $version = (cat "ImageMagick-Windows\VisualMagick\installer\inc\version.isx" | Select-String "MagickPackageVersion") | Out-String
257        $version = ($version | Select-String '".*"' -AllMatches |  Select -Expand Matches | Select -Expand Value | Out-String)
258        $version = $version -Replace "`n|`r|""",""
259        Write-Host "::set-output name=version::$version"
260
261    - uses: actions/upload-artifact@v2
262      with:
263        name: 'ImageMagick-${{steps.package.outputs.version}}-portable-${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.platform}}'
264        path: portable