-
-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (79 loc) · 3.09 KB
/
installer-release.yml
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
name: Solid - Build installer and create release
on:
push:
tags:
- 'v*' # Build an installer for commits that are tagged starting with 'v' e.g. v1.0
pull_request:
branches:
- main
jobs:
build-installer:
name: Build Release And Make Installer
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Set VERSION (e.g. 1.0.0) and FULL_VERSION (e.g. 1.0.0-abcdef4)
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
SHORT_SHA=$(git rev-parse --short HEAD)
FULL_VERSION="${VERSION}-${SHORT_SHA}"
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "FULL_VERSION=${FULL_VERSION}" >> $GITHUB_ENV
shell: bash
- name: Validate version format
run: |
if [[ ! "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Version = '${VERSION}' format is incorrect. It should match N.N.N where N is an integer."
exit 1
fi
shell: bash
- name: Cache NuGet packages
id: cache-nuget
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore
run: dotnet restore src/solid.sln
- name: Update AssemblyInfo.cs
run: |
$filePath = "src\SolidGui\Properties\AssemblyInfo.cs"
(Get-Content $filePath) -replace 'AssemblyVersion\(".*\)', 'AssemblyVersion("${{ env.VERSION }}.0")' |
Set-Content $filePath
(Get-Content $filePath) -replace 'AssemblyFileVersion\(".*\)', 'AssemblyFileVersion("${{ env.VERSION }}.0")' |
Set-Content $filePath
(Get-Content $filePath) -replace 'AssemblyInformationalVersion\(".*\)', 'AssemblyInformationalVersion("${{ env.FULL_VERSION }}")' |
Set-Content $filePath
shell: powershell
- name: Verify Update
run: Get-Content "src\SolidGui\Properties\AssemblyInfo.cs"
shell: powershell
- name: Build version ${{ env.VERSION }}
run: dotnet build -c Release src/solid.sln --no-restore
- name: List files and subdirectories
run: |
$path = "output" # Change this to your target path
Get-ChildItem -Path $path -Recurse
shell: powershell
- name: Build Installer
run: iscc /DMyAppVersion=${{ env.VERSION }} installer/setup.iss
- name: Sign Installer
uses: sillsdev/codesign/trusted-signing-action@v3
if: startsWith(github.ref, 'refs/tags/v')
with:
credentials: ${{ secrets.TRUSTED_SIGNING_CREDENTIALS }}
files-folder: installer/Output
files-folder-filter: SolidInstaller*.exe
- name: Create Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: installer/Output/SolidInstaller*.exe
body: |
Release for version ${{ github.ref }}
draft: true