Repository navigation
167 lines (154 loc) · 6.08 KB
/
Copy pathrelease.yml
File metadata and controls
167 lines (154 loc) · 6.08 KB
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
name: Release
on:
push:
tags:
- 'v*'
- '*.*.*'
workflow_dispatch:
inputs:
tag:
description: 'Tag istniejącego release (np. 1.2.0 albo v1.2.0)'
required: true
default: '1.2.0'
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Resolve version
id: meta
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$raw = '${{ github.event.inputs.tag }}'
if ([string]::IsNullOrWhiteSpace($raw)) {
$raw = $env:GITHUB_REF_NAME
}
$version = $raw.TrimStart('v')
if ($version -notmatch '^\d+\.\d+\.\d+') {
throw "Nie moge odczytac wersji z taga '$raw'. Uzyj np. 1.2.0 albo v1.2.0."
}
"tag=$raw" >> $env:GITHUB_OUTPUT
"version=$version" >> $env:GITHUB_OUTPUT
Write-Host "Building KEYRA $version (tag $raw)"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Publish win-x64
run: >
dotnet publish src/SshKeyManager/SshKeyManager.csproj
-c Release
-r win-x64
--self-contained true
-p:PublishSingleFile=true
-p:IncludeNativeLibrariesForSelfExtract=true
-o dist/win-x64
- name: Zip artifact
shell: pwsh
run: |
$version = '${{ steps.meta.outputs.version }}'
Compress-Archive -Path 'dist/win-x64/*' -DestinationPath "KEYRA-$version-win-x64.zip" -Force
- name: Install Inno Setup
run: choco install innosetup --no-progress -y
- name: Build installer
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$version = '${{ steps.meta.outputs.version }}'
New-Item -ItemType Directory -Force -Path dist\installer | Out-Null
$issPath = Join-Path $pwd 'keyra-setup.iss'
$iconLine = ''
$icon = Join-Path $pwd 'src\SshKeyManager\Assets\keyra-icon.ico'
if (Test-Path -LiteralPath $icon) {
$iconLine = 'SetupIconFile=src\SshKeyManager\Assets\keyra-icon.ico'
}
$appId = '{' + '{8F3A1C2E-9B47-4D6A-A1E8-0C5B7F2D4E91}'
$issLines = @(
'#ifndef MyAppVersion'
'#define MyAppVersion "0.0.0"'
'#endif'
'#define MyAppName "KEYRA"'
'#define MyAppPublisher "KEYRA"'
'#define MyAppExeName "SshKeyManager.exe"'
'#define MyAppVersionInfo MyAppVersion + ".0"'
''
'[Setup]'
"AppId=$appId"
'AppName={#MyAppName}'
'AppVersion={#MyAppVersion}'
'AppVerName={#MyAppName} {#MyAppVersion}'
'AppPublisher={#MyAppPublisher}'
'AppCopyright=Copyright (c) 2026 KEYRA contributors'
'VersionInfoVersion={#MyAppVersionInfo}'
'VersionInfoProductName={#MyAppName}'
'VersionInfoProductVersion={#MyAppVersionInfo}'
'DefaultDirName={localappdata}\Programs\KEYRA'
'DefaultGroupName={#MyAppName}'
'DisableProgramGroupPage=yes'
'LicenseFile=LICENSE'
'OutputDir=dist\installer'
'OutputBaseFilename=KEYRA-{#MyAppVersion}-win-x64-setup'
$iconLine
'UninstallDisplayIcon={app}\{#MyAppExeName}'
'Compression=lzma2/ultra64'
'SolidCompression=yes'
'WizardStyle=modern'
'PrivilegesRequired=lowest'
'ArchitecturesAllowed=x64compatible'
'ArchitecturesInstallIn64BitMode=x64compatible'
'MinVersion=10.0'
'CloseApplications=yes'
'RestartApplications=no'
'UninstallDisplayName={#MyAppName}'
'UsePreviousAppDir=yes'
''
'[Languages]'
'Name: "english"; MessagesFile: "compiler:Default.isl"'
'Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"'
''
'[Tasks]'
'Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked'
''
'[Files]'
'Source: "dist\win-x64\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.pdb"'
''
'[Icons]'
'Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Comment: "SSH key vault and SSH client"'
'Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Comment: "SSH key vault and SSH client"; Tasks: desktopicon'
''
'[Run]'
'Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, ''&'', ''&&'')}}"; Flags: nowait postinstall skipifsilent'
)
$iss = $issLines -join "`r`n"
[System.IO.File]::WriteAllText($issPath, $iss + "`r`n")
$iscc = Join-Path ${env:ProgramFiles(x86)} 'Inno Setup 6\ISCC.exe'
if (-not (Test-Path -LiteralPath $iscc)) {
$iscc = Join-Path $env:ProgramFiles 'Inno Setup 6\ISCC.exe'
}
if (-not (Test-Path -LiteralPath $iscc)) {
throw 'ISCC.exe not found after Chocolatey install'
}
& $iscc /Q "/DMyAppVersion=$version" $issPath
if ($LASTEXITCODE -ne 0) {
throw "ISCC.exe exited with code $LASTEXITCODE"
}
$setup = Join-Path $pwd "dist\installer\KEYRA-$version-win-x64-setup.exe"
if (-not (Test-Path -LiteralPath $setup)) {
throw "Installer was not produced: $setup"
}
Write-Host "Installer: $setup"
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.meta.outputs.tag }}
files: |
KEYRA-*-win-x64.zip
dist/installer/KEYRA-*-win-x64-setup.exe
fail_on_unmatched_files: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}