Skip to content

Commit b706c11

Browse files
committed
Changed workflow to publish a release with all our release artifacts.
1 parent d7cc1f7 commit b706c11

File tree

1 file changed

+131
-124
lines changed

1 file changed

+131
-124
lines changed

.github/workflows/release.yml

Lines changed: 131 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
on:
22
workflow_dispatch:
3+
schedule:
4+
- cron: 0 6 * * *
35
push:
46
branches:
57
- main
@@ -8,7 +10,7 @@ on:
810
- m4/version.m4
911
- .github/build/windows/download-configure.sh
1012
- .github/build/windows/download-dependencies.sh
11-
- .github/workflows/windows-release.yml
13+
- .github/workflows/release.yml
1214
pull_request:
1315
branches:
1416
- main
@@ -19,12 +21,39 @@ name: Release
1921
permissions:
2022
contents: read
2123
jobs:
22-
change_log:
24+
version:
25+
name: Set version
26+
runs-on: ubuntu-24.04
27+
outputs:
28+
version: ${{ steps.version.outputs.version }}
29+
publish: ${{ steps.version.outputs.publish }}
30+
31+
steps:
32+
- name: Clone ImageMagick
33+
uses: actions/checkout@v5
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Set version
38+
id: version
39+
run: |
40+
version=$(grep -oP "PACKAGE_VERSION='\K[0-9\.-]*" configure)
41+
echo "version=$version" >> $GITHUB_OUTPUT
42+
echo "version=$version"
43+
tag=$(git describe --tags HEAD --exact-match || true)
44+
if [[ "$tag" == "$version" ]]; then
45+
echo "publish=true" >> $GITHUB_OUTPUT
46+
echo "publish=true"
47+
fi
48+
49+
changelog:
2350
name: Create ChangeLog.md
2451
runs-on: ubuntu-24.04
52+
needs:
53+
- version
2554

2655
steps:
27-
- name: Checkout
56+
- name: Clone ImageMagick
2857
uses: actions/checkout@v5
2958
with:
3059
fetch-depth: 0
@@ -33,24 +62,28 @@ jobs:
3362
run: npm install -g auto-changelog
3463

3564
- name: Create ChangeLog.md
65+
env:
66+
VERSION: ${{needs.version.outputs.version}}
3667
run: |
37-
export NEXT_VERSION=$(grep -oP "PACKAGE_VERSION='\K[0-9\.-]*" configure)
38-
git tag $NEXT_VERSION
68+
if ! git tag -l | grep -q "^$VERSION$"; then
69+
git tag $VERSION
70+
fi
3971
auto-changelog --sort-commits date
40-
mkdir artifacts
41-
mv ChangeLog.md artifacts/ChangeLog.md
72+
mkdir -p Artifacts
73+
mv ChangeLog.md Artifacts/ChangeLog.md
4274
4375
- name: Upload ChangeLog.md
4476
uses: actions/upload-artifact@v4
4577
with:
4678
name: ChangeLog
47-
path: artifacts
79+
path: Artifacts
4880

49-
release_windows_installer:
50-
name: Windows ${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}} (${{matrix.typeName}})
51-
needs:
52-
- change_log
81+
windows_installer:
82+
name: Windows ${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}} (${{matrix.buildType}})
5383
runs-on: windows-2022
84+
needs:
85+
- changelog
86+
- version
5487

5588
permissions:
5689
contents: read
@@ -61,7 +94,7 @@ jobs:
6194
matrix:
6295
architecture: [ x64, x86 ]
6396
buildType: [ dynamic, static ]
64-
quantum: [ Q8, Q16 ]
97+
quantum: [ Q16, Q8 ]
6598
hdri: [ hdri, noHdri ]
6699
exclude:
67100
- quantum: Q8
@@ -76,10 +109,24 @@ jobs:
76109
- buildType: static
77110
typeName: static
78111
- hdri: hdri
79-
hdri_flag: '-HDRI'
112+
hdri_flag: -HDRI
80113

81114
steps:
82-
- name: Clone ImageMagick6
115+
- name: Install Strawberry Perl
116+
if: ${{matrix.buildType == 'dynamic'}}
117+
shell: cmd
118+
run: |
119+
powershell Invoke-WebRequest -Uri https://github.com/ImageMagick/Windows/releases/download/build-binaries-2025-08-30/strawberry-perl-5.30.2.1-${{matrix.bit}}bit.msi -OutFile strawberry-perl-5.30.2.1-${{matrix.bit}}bit.msi
120+
msiexec /i strawberry-perl-5.30.2.1-${{matrix.bit}}bit.msi /qn INSTALLDIR="C:\Strawberry${{matrix.bit}}"
121+
mv "C:\Strawberry" "C:\Strawberry64"
122+
123+
- name: Install Inno Setup
124+
shell: cmd
125+
run: |
126+
powershell Invoke-WebRequest -Uri https://github.com/ImageMagick/Windows/releases/download/build-binaries-2025-08-30/innosetup-6.2.0.exe -OutFile innosetup-6.2.0.exe
127+
innosetup-6.2.0.exe /SILENT /SUPPRESSMSGBOXES /NORESTART /SP-
128+
129+
- name: Clone ImageMagick
83130
uses: actions/checkout@v5
84131
with:
85132
path: ImageMagick
@@ -100,20 +147,6 @@ jobs:
100147
name: ChangeLog
101148
path: ImageMagick
102149

103-
- name: Install Strawberry Perl
104-
if: ${{matrix.buildType == 'dynamic'}}
105-
shell: cmd
106-
run: |
107-
powershell Invoke-WebRequest -Uri https://github.com/ImageMagick/Windows/releases/download/build-binaries-2025-08-30/strawberry-perl-5.30.2.1-${{matrix.bit}}bit.msi -OutFile strawberry-perl-5.30.2.1-${{matrix.bit}}bit.msi
108-
msiexec /i strawberry-perl-5.30.2.1-${{matrix.bit}}bit.msi /qn INSTALLDIR="C:\Strawberry${{matrix.bit}}"
109-
mv "C:\Strawberry" "C:\Strawberry64"
110-
111-
- name: Install Inno Setup
112-
shell: cmd
113-
run: |
114-
powershell Invoke-WebRequest -Uri https://github.com/ImageMagick/Windows/releases/download/build-binaries-2025-08-30/innosetup-6.2.0.exe -OutFile innosetup-6.2.0.exe
115-
innosetup-6.2.0.exe /SILENT /SUPPRESSMSGBOXES /NORESTART /SP-
116-
117150
- name: Configure ImageMagick
118151
shell: cmd
119152
working-directory: Configure
@@ -138,28 +171,13 @@ jobs:
138171
nmake
139172
nmake release
140173
141-
- name: 'Azure CLI login with federated credential'
142-
if: github.event_name != 'pull_request'
143-
uses: azure/login@v2
144-
with:
145-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
146-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
147-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
148-
149-
- name: Install sign cli
150-
if: github.event_name != 'pull_request'
151-
run: dotnet tool install --global sign --prerelease
152-
153174
- name: Sign executables and libraries
154-
if: github.event_name != 'pull_request'
155-
run: sign code trusted-signing `
156-
--trusted-signing-account ImageMagick `
157-
--trusted-signing-certificate-profile ImageMagick `
158-
--trusted-signing-endpoint https://eus.codesigning.azure.net `
159-
--azure-credential-type azure-cli `
160-
--verbosity information `
161-
*.exe *.dll
162-
working-directory: Artifacts/bin
175+
uses: ImageMagick/.github/actions/code-signing@main
176+
with:
177+
client-id: ${{secrets.AZURE_CLIENT_ID}}
178+
tenant-id: ${{secrets.AZURE_TENANT_ID}}
179+
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}}
180+
directory: Artifacts\bin
163181

164182
- name: Create installer
165183
shell: cmd
@@ -168,36 +186,24 @@ jobs:
168186
"C:\Program Files (x86)\Inno Setup 6\iscc.exe" Configure\Installer\Inno\ImageMagick.iss
169187
170188
- name: Sign installer
171-
if: github.event_name != 'pull_request'
172-
run: sign code trusted-signing `
173-
--trusted-signing-account ImageMagick `
174-
--trusted-signing-certificate-profile ImageMagick `
175-
--trusted-signing-endpoint https://eus.codesigning.azure.net `
176-
--azure-credential-type azure-cli `
177-
--verbosity information `
178-
*.exe
179-
working-directory: Configure/Installer/Inno/Artifacts
180-
181-
- name: Get version
182-
id: version
183-
shell: pwsh
184-
run: |
185-
$version = (cat "Configure\Installer\Inno\config.isx" | Select-String "MagickPackageFullVersionText") | Out-String
186-
$version = ($version | Select-String '".*"' -AllMatches | Select -Expand Matches | Select -Expand Value | Out-String)
187-
$version = $version -Replace "`n|`r|""",""
188-
$version = $version -Replace " ","-"
189-
echo "version=$version" >> $env:GITHUB_OUTPUT
189+
uses: ImageMagick/.github/actions/code-signing@main
190+
with:
191+
client-id: ${{secrets.AZURE_CLIENT_ID}}
192+
tenant-id: ${{secrets.AZURE_TENANT_ID}}
193+
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}}
194+
directory: Configure\Installer\Inno\Artifacts
190195

191196
- uses: actions/upload-artifact@v4
192197
with:
193-
name: 'ImageMagick-${{steps.version.outputs.version}}-${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.typeName}}-${{matrix.architecture}}'
194-
path: 'Configure\Installer\Inno\Artifacts'
198+
name: ImageMagick-${{needs.version.outputs.version}}-${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.typeName}}-${{matrix.architecture}}.exe
199+
path: Configure\Installer\Inno\Artifacts
195200

196-
release_windows_source:
201+
windows_source:
197202
name: Windows source
198-
needs:
199-
- change_log
200203
runs-on: windows-2022
204+
needs:
205+
- changelog
206+
- version
201207

202208
steps:
203209
- name: Clone ImageMagick/Windows
@@ -220,22 +226,23 @@ jobs:
220226
- name: Create source archive
221227
shell: cmd
222228
run: |
223-
mkdir Source
224-
move Configure Source
225-
move Dependencies Source
226-
move ImageMagick Source
227-
7z a ImageMagick6-Windows.7z .\Source\*
229+
mkdir source
230+
move Configure source
231+
move Dependencies source
232+
move ImageMagick source
233+
7z a ImageMagick-${{needs.version.outputs.version}}-Windows.7z .\source\*
228234
229235
- uses: actions/upload-artifact@v4
230236
with:
231-
name: ImageMagick6-Windows
232-
path: ImageMagick6-Windows.7z
237+
name: ImageMagick-${{needs.version.outputs.version}}-Windows.7z
238+
path: ImageMagick-${{needs.version.outputs.version}}-Windows.7z
233239

234-
release_windows_portable:
240+
windows_portable:
235241
name: Windows portable ${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}}
236-
needs:
237-
- change_log
238242
runs-on: windows-2022
243+
needs:
244+
- changelog
245+
- version
239246

240247
permissions:
241248
contents: read
@@ -245,23 +252,17 @@ jobs:
245252
fail-fast: false
246253
matrix:
247254
architecture: [ x64, x86 ]
248-
quantum: [ Q8, Q16 ]
255+
quantum: [ Q16, Q8 ]
249256
hdri: [ hdri, noHdri ]
250257
exclude:
251258
- quantum: Q8
252259
hdri: hdri
253260
include:
254-
- architecture: x64
255-
bit: 64
256-
- architecture: arm64
257-
bit: 64
258-
- architecture: x86
259-
bit: 32
260261
- hdri: hdri
261-
hdri_flag: '-HDRI'
262+
hdri_flag: -HDRI
262263

263264
steps:
264-
- name: Clone ImageMagick6
265+
- name: Clone ImageMagick
265266
uses: actions/checkout@v5
266267
with:
267268
path: ImageMagick
@@ -294,31 +295,15 @@ jobs:
294295
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat"
295296
msbuild /m /t:Rebuild /p:Configuration=Release,Platform=${{matrix.architecture}}
296297
297-
- name: 'Azure CLI login with federated credential'
298-
if: github.event_name != 'pull_request'
299-
uses: azure/login@v2
298+
- name: Sign executables and libraries
299+
uses: ImageMagick/.github/actions/code-signing@main
300300
with:
301-
client-id: ${{ secrets.AZURE_CLIENT_ID }}
302-
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
303-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
304-
305-
- name: Install sign cli
306-
if: github.event_name != 'pull_request'
307-
run: dotnet tool install --global sign --prerelease
308-
309-
- name: Sign executables
310-
if: github.event_name != 'pull_request'
311-
run: sign code trusted-signing `
312-
--trusted-signing-account ImageMagick `
313-
--trusted-signing-certificate-profile ImageMagick `
314-
--trusted-signing-endpoint https://eus.codesigning.azure.net `
315-
--azure-credential-type azure-cli `
316-
--verbosity information `
317-
*.exe
318-
working-directory: Artifacts/bin
301+
client-id: ${{secrets.AZURE_CLIENT_ID}}
302+
tenant-id: ${{secrets.AZURE_TENANT_ID}}
303+
subscription-id: ${{secrets.AZURE_SUBSCRIPTION_ID}}
304+
directory: Artifacts\bin
319305

320306
- name: Copy Files
321-
id: package
322307
shell: pwsh
323308
run: |
324309
[void](New-Item -Name "portable" -ItemType directory)
@@ -328,16 +313,38 @@ jobs:
328313
329314
Copy-Item "Artifacts\NOTICE.txt" "portable"
330315
Copy-Item "ImageMagick\ChangeLog.md" "portable"
331-
Copy-Item "ImageMagick\README.txt" "portable"
332316
Copy-Item "ImageMagick\LICENSE" "portable\LICENSE.txt"
333-
334-
$version = (cat "Configure\Installer\Inno\config.isx" | Select-String "MagickPackageFullVersionText") | Out-String
335-
$version = ($version | Select-String '".*"' -AllMatches | Select -Expand Matches | Select -Expand Value | Out-String)
336-
$version = $version -Replace "`n|`r|""",""
337-
$version = $version -Replace " ","-"
338-
echo "version=$version" >> $env:GITHUB_OUTPUT
317+
7z a ImageMagick-${{needs.version.outputs.version}}-portable-${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}}.7z .\portable\*
339318
340319
- uses: actions/upload-artifact@v4
341320
with:
342-
name: 'ImageMagick-${{steps.package.outputs.version}}-portable-${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}}'
343-
path: portable
321+
name: ImageMagick-${{needs.version.outputs.version}}-portable-${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}}.7z
322+
path: ImageMagick-${{needs.version.outputs.version}}-portable-${{matrix.quantum}}${{matrix.hdri_flag}}-${{matrix.architecture}}.7z
323+
324+
release:
325+
name: Publish Release
326+
if: ${{ needs.version.outputs.publish == 'true' }}
327+
runs-on: ubuntu-24.04
328+
needs:
329+
- version
330+
- windows_installer
331+
- windows_portable
332+
- windows_source
333+
334+
permissions:
335+
contents: write
336+
337+
steps:
338+
- name: Clone ImageMagick
339+
uses: actions/checkout@v5
340+
341+
- name: Download artifacts
342+
uses: actions/download-artifact@v5
343+
with:
344+
path: artifacts
345+
merge-multiple: true
346+
347+
- name: Publish release
348+
env:
349+
GH_TOKEN: ${{github.token}}
350+
run: gh release create ${{needs.version.outputs.version}} --title "${{needs.version.outputs.version}}" ${{github.workspace}}/artifacts/*.7z ${{github.workspace}}/artifacts/*.exe

0 commit comments

Comments
 (0)