Skip to content

Commit 4880375

Browse files
committed
Update the release YAML file with all of the artificats needed for a full release
1 parent 0797c79 commit 4880375

File tree

1 file changed

+101
-15
lines changed

1 file changed

+101
-15
lines changed

.github/workflows/release.yml

Lines changed: 101 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ concurrency:
2020
cancel-in-progress: true
2121

2222
env:
23+
PROJECT: 'MagickCrop'
2324
PROJECT_PATH: 'MagickCrop/MagickCrop.csproj'
24-
PUBLISH_DIR: 'publish'
25-
ARTIFACT_ZIP: 'MagickCrop-win-x64.zip'
25+
BUILD_X64: 'bld/x64'
26+
BUILD_X64_SC: 'bld/x64/MagickCrop-Self-Contained'
27+
BUILD_ARM64: 'bld/arm64'
28+
BUILD_ARM64_SC: 'bld/arm64/MagickCrop-arm64-Self-Contained'
2629

2730
jobs:
2831
build:
@@ -38,29 +41,111 @@ jobs:
3841
- name: Install dependencies
3942
run: dotnet restore ${{ env.PROJECT_PATH }}
4043

41-
- name: Build
42-
run: dotnet build ${{ env.PROJECT_PATH }}
44+
- name: Compute build version and archive paths
45+
shell: pwsh
46+
run: |
47+
$version = Get-Date -Format 'yyyy-MM-dd'
48+
echo "VERSION=$version" >> $env:GITHUB_ENV
49+
echo "ARCHIVE_X64_SC=${{ env.BUILD_X64 }}/${{ env.PROJECT }}-x64-Self-Contained-$version.zip" >> $env:GITHUB_ENV
50+
echo "ARCHIVE_ARM64_SC=${{ env.BUILD_ARM64 }}/${{ env.PROJECT }}-arm64-Self-Contained-$version.zip" >> $env:GITHUB_ENV
51+
52+
- name: Clean build directories
53+
shell: pwsh
54+
run: |
55+
if (Test-Path '${{ env.BUILD_X64 }}') { Remove-Item '${{ env.BUILD_X64 }}' -Recurse -Force }
56+
if (Test-Path '${{ env.BUILD_ARM64 }}') { Remove-Item '${{ env.BUILD_ARM64 }}' -Recurse -Force }
57+
New-Item -ItemType Directory -Path '${{ env.BUILD_X64 }}' -Force | Out-Null
58+
New-Item -ItemType Directory -Path '${{ env.BUILD_ARM64 }}' -Force | Out-Null
59+
60+
- name: Build x64 framework-dependent
61+
run: >-
62+
dotnet publish ${{ env.PROJECT_PATH }}
63+
--runtime win-x64
64+
--self-contained false
65+
-c Release
66+
-v minimal
67+
-o ${{ env.BUILD_X64 }}
68+
-p:EnableMsixTooling=true
69+
-p:PublishReadyToRun=false
70+
-p:PublishSingleFile=true
71+
-p:CopyOutputSymbolsToPublishDirectory=false
72+
--nologo
73+
74+
- name: Build x64 self-contained
75+
run: >-
76+
dotnet publish ${{ env.PROJECT_PATH }}
77+
--runtime win-x64
78+
--self-contained true
79+
-c Release
80+
-v minimal
81+
-o ${{ env.BUILD_X64_SC }}
82+
-p:EnableMsixTooling=true
83+
-p:PublishReadyToRun=true
84+
-p:PublishSingleFile=true
85+
-p:CopyOutputSymbolsToPublishDirectory=false
86+
--nologo
87+
88+
- name: Build ARM64 framework-dependent
89+
run: >-
90+
dotnet publish ${{ env.PROJECT_PATH }}
91+
--runtime win-arm64
92+
--self-contained false
93+
-c Release
94+
-v minimal
95+
-o ${{ env.BUILD_ARM64 }}
96+
-p:PublishSingleFile=true
97+
-p:EnableMsixTooling=true
98+
-p:CopyOutputSymbolsToPublishDirectory=false
99+
--nologo
43100
44-
- name: Build for release and Publish (win-x64)
101+
- name: Build ARM64 self-contained
45102
run: >-
46103
dotnet publish ${{ env.PROJECT_PATH }}
104+
--runtime win-arm64
105+
--self-contained true
47106
-c Release
48-
--self-contained
49-
-r win-x64
107+
-v minimal
108+
-o ${{ env.BUILD_ARM64_SC }}
50109
-p:PublishSingleFile=true
51-
-o ${{ env.PUBLISH_DIR }}
110+
-p:EnableMsixTooling=true
111+
-p:CopyOutputSymbolsToPublishDirectory=false
112+
--nologo
113+
114+
- name: Rename ARM64 executables
115+
shell: pwsh
116+
run: |
117+
if (Test-Path "${{ env.BUILD_ARM64 }}/${{ env.PROJECT }}.exe") {
118+
Rename-Item "${{ env.BUILD_ARM64 }}/${{ env.PROJECT }}.exe" 'MagickCrop-arm64.exe'
119+
}
120+
if (Test-Path "${{ env.BUILD_ARM64_SC }}/${{ env.PROJECT }}.exe") {
121+
Rename-Item "${{ env.BUILD_ARM64_SC }}/${{ env.PROJECT }}.exe" 'MagickCrop-arm64.exe'
122+
}
123+
124+
- name: Create self-contained archives
125+
shell: pwsh
126+
run: |
127+
if (Test-Path "${{ env.ARCHIVE_X64_SC }}") { Remove-Item -Force "${{ env.ARCHIVE_X64_SC }}" }
128+
if (Test-Path "${{ env.ARCHIVE_ARM64_SC }}") { Remove-Item -Force "${{ env.ARCHIVE_ARM64_SC }}" }
129+
Compress-Archive -Path "${{ env.BUILD_X64_SC }}" -DestinationPath "${{ env.ARCHIVE_X64_SC }}" -Force
130+
Compress-Archive -Path "${{ env.BUILD_ARM64_SC }}" -DestinationPath "${{ env.ARCHIVE_ARM64_SC }}" -Force
52131
53-
- name: Create ZIP archive of publish output
132+
- name: Version information
54133
shell: pwsh
55134
run: |
56-
if (Test-Path "${{ env.ARTIFACT_ZIP }}") { Remove-Item -Force "${{ env.ARTIFACT_ZIP }}" }
57-
Compress-Archive -Path "${{ env.PUBLISH_DIR }}/*" -DestinationPath "${{ env.ARTIFACT_ZIP }}"
135+
$exe = Join-Path '${{ env.BUILD_X64 }}' '${{ env.PROJECT }}.exe'
136+
if (Test-Path $exe) {
137+
$vi = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($exe)
138+
Write-Host "Product Version: $($vi.ProductVersion)"
139+
Write-Host "File Version: $($vi.FileVersion)"
140+
}
58141
59-
- name: Upload build artifact (ZIP)
142+
- name: Upload build artifacts (ZIPs)
60143
uses: actions/upload-artifact@v4
61144
with:
62-
name: MagickCrop-win-x64
63-
path: ${{ env.ARTIFACT_ZIP }}
145+
name: MagickCrop-zips
146+
path: |
147+
${{ env.ARCHIVE_X64_SC }}
148+
${{ env.ARCHIVE_ARM64_SC }}
64149
65150
- name: Compute release tag and name
66151
shell: pwsh
@@ -86,4 +171,5 @@ jobs:
86171
generate_release_notes: true
87172
fail_on_unmatched_files: true
88173
files: |
89-
${{ env.ARTIFACT_ZIP }}
174+
${{ env.ARCHIVE_X64_SC }}
175+
${{ env.ARCHIVE_ARM64_SC }}

0 commit comments

Comments
 (0)