-
-
Notifications
You must be signed in to change notification settings - Fork 3
212 lines (187 loc) · 8.12 KB
/
release.yml
File metadata and controls
212 lines (187 loc) · 8.12 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: Create Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'The tag to build (e.g., v0.1.0). A changelog file for this tag MUST exist.'
required: true
type: string
permissions:
contents: write
jobs:
build_and_pack:
name: Build & Pack on ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: win-x64
rid: win-x64
tfm: net8.0-windows
- os: ubuntu-latest
platform: linux-x64
rid: linux-x64
tfm: net8.0
- os: ubuntu-latest
platform: linux-arm64
rid: linux-arm64
tfm: net8.0
- os: macos-latest
platform: osx-x64
rid: osx-x64
tfm: net8.0-macos
- os: macos-latest
platform: osx-arm64
rid: osx-arm64
tfm: net8.0-macos
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Install Velopack CLI
run: dotnet tool install vpk -g
- name: Get App Version from .csproj
id: get_version
shell: pwsh
run: |
$version = ([xml](Get-Content -Path ProseFlow.UI/ProseFlow.UI.csproj)).Project.PropertyGroup.Version
echo "APP_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Set up QEMU for ARM64 cross-compilation
if: matrix.platform == 'linux-arm64'
uses: docker/setup-qemu-action@v3
with:
platforms: linux/arm64
- name: Restore .NET Workloads
run: dotnet workload restore
- name: Publish application
shell: bash
run: |
PUBLISH_ARGS=""
if [[ ! "${{ matrix.platform }}" =~ ^osx-.* ]]; then
PUBLISH_ARGS="-p:PublishSingleFile=true"
fi
if [[ "${{ matrix.platform }}" =~ ^osx-.* ]]; then
PUBLISH_ARGS="$PUBLISH_ARGS -p:CreatePackage=false"
fi
dotnet publish ProseFlow.UI \
-c Release \
-r ${{ matrix.rid }} \
--self-contained \
-f ${{ matrix.tfm }} \
-p:UseAppHost=true \
-o "publish" \
$PUBLISH_ARGS
- name: Pack with Velopack
shell: pwsh
run: |
$originalNotesFile = "Changelogs/${{ github.event_name == 'push' && github.ref_name || inputs.version }}.md"
$sanitizedNotesFile = "sanitized-notes.md"
$originalContent = Get-Content -Path $originalNotesFile -Raw
$sanitizedContent = [System.Security.SecurityElement]::Escape($originalContent)
Set-Content -Path $sanitizedNotesFile -Value $sanitizedContent -Encoding utf8
if ("${{ matrix.platform }}".StartsWith("osx-")) {
$generatedPListPath = "Info-generated.plist"
$plistLines = @(
'<?xml version="1.0" encoding="utf-8"?>',
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">',
'<plist version="1.0">',
' <dict>',
' <key>CFBundleName</key>',
' <string>ProseFlow</string>',
' <key>CFBundleIdentifier</key>',
' <string>com.ProseFlow.ProseFlow</string>',
" <key>CFBundleVersion</key>",
" <string>$($env:APP_VERSION)</string>",
' <key>CFBundlePackageType</key>',
' <string>APPL</string>',
' <key>CFBundleSignature</key>',
' <string>????</string>',
' <key>CFBundleExecutable</key>',
' <string>ProseFlow</string>',
' <key>CFBundleIconFile</key>',
' <string>DefaultApp.icns</string>',
" <key>CFBundleShortVersionString</key>",
" <string>$($env:APP_VERSION)</string>",
' <key>NSPrincipalClass</key>',
' <string>NSApplication</string>',
' <key>NSHighResolutionCapable</key>',
' <true />',
' <key>NSAccessibilityUsageDescription</key>',
' <string>ProseFlow needs access to monitor keyboard input to enable global hotkeys, allowing you to trigger actions even when the app is in the background.</string>',
' <key>NSAppleEventsUsageDescription</key>',
' <string>ProseFlow needs permission to control other applications to perform actions.</string>',
' <key>NSInputMonitoringUsageDescription</key>',
' <string>ProseFlow requires access to monitor keyboard events to detect your custom hotkeys, even when the app is in the background.</string>',
' <key>NSPrivacyAccessibilityUsageDescription</key>',
' <string>ProseFlow needs access to control your computer to respond to global hotkeys and automatically copy/paste text in any application.</string>',
' <key>NSPrivacyInputMonitoringUsageDescription</key>',
' <string>ProseFlow requires access to monitor keyboard events to detect your custom hotkeys, even when the app is in the background.</string>',
' </dict>',
'</plist>'
)
$plistContent = $plistLines -join "`n"
Set-Content -Path $generatedPListPath -Value $plistContent -Encoding utf8
$packDir = "ProseFlow.UI/bin/Release/${{ matrix.tfm }}/${{ matrix.rid }}"
vpk pack `
-u ProseFlow `
-v ${{ env.APP_VERSION }} `
-p $packDir `
-o "Velo-Output" `
-r ${{ matrix.rid }} `
--icon "ProseFlow.UI/Assets/logo.icns" `
--channel ${{ matrix.platform }} `
--releaseNotes $sanitizedNotesFile `
--mainExe ProseFlow.app/Contents/MacOS/ProseFlow `
--plist $generatedPListPath
} else {
vpk pack `
-u ProseFlow `
-v ${{ env.APP_VERSION }} `
-p "publish" `
-o "Velo-Output" `
-r ${{ matrix.rid }} `
--icon "ProseFlow.UI/Assets/logo.ico" `
--channel ${{ matrix.platform }} `
--releaseNotes $sanitizedNotesFile
}
- name: Upload Release Artifacts
uses: actions/upload-artifact@v4
with:
name: release-artifacts-${{ matrix.platform }}
path: Velo-Output/*
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build_and_pack
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get App Version from .csproj
id: get_version
shell: bash
run: |
version=$(grep '<Version>' ProseFlow.UI/ProseFlow.UI.csproj | sed -e 's/.*<Version>\(.*\)<\/Version>.*/\1/')
echo "APP_VERSION=$version" >> $GITHUB_ENV
- name: Download all release artifacts
uses: actions/download-artifact@v4
with:
path: release-assets
pattern: release-artifacts-*
merge-multiple: true
- name: List downloaded files
run: ls -R release-assets
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2.3.3
with:
tag_name: ${{ github.event_name == 'push' && github.ref_name || inputs.version }}
name: "ProseFlow ${{ github.event_name == 'push' && github.ref_name || inputs.version }}"
body_path: "Changelogs/${{ github.event_name == 'push' && github.ref_name || inputs.version }}.md"
files: release-assets/*