Repository navigation
68 lines (56 loc) · 1.87 KB
/
Copy pathpublish-installer.yml
File metadata and controls
68 lines (56 loc) · 1.87 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
name: Publish Windows installer
on:
push:
branches:
- main
- master
permissions:
contents: write
concurrency:
group: publish-installer-${{ github.ref }}
cancel-in-progress: false
jobs:
build-and-release:
name: Build and release Windows installer
runs-on: windows-latest
env:
RELEASE_VERSION: 1.0.${{ github.run_number }}
RELEASE_TAG: v1.0.${{ github.run_number }}
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Install Inno Setup
shell: pwsh
run: choco install innosetup --yes --no-progress --limit-output
- name: Build installer
shell: pwsh
run: >-
.\installer\build-installer.ps1
-Configuration Release
-Runtime win-x64
-Version $env:RELEASE_VERSION
- name: Publish GitHub release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
INSTALLER_PATH: installer\Output\NoteManager-${{ env.RELEASE_VERSION }}-win-x64-Setup.exe
run: |
$ErrorActionPreference = "Stop"
if (-not (Test-Path -LiteralPath $env:INSTALLER_PATH -PathType Leaf)) {
throw "Installer artifact was not created: '$env:INSTALLER_PATH'."
}
gh release view $env:RELEASE_TAG --repo $env:GITHUB_REPOSITORY *> $null
$releaseExists = $LASTEXITCODE -eq 0
if ($releaseExists) {
gh release upload $env:RELEASE_TAG $env:INSTALLER_PATH --clobber --repo $env:GITHUB_REPOSITORY
}
else {
gh release create $env:RELEASE_TAG $env:INSTALLER_PATH `
--title "NoteManager $env:RELEASE_VERSION" `
--generate-notes `
--repo $env:GITHUB_REPOSITORY
}