-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (153 loc) Β· 5.92 KB
/
build-and-release.yml
File metadata and controls
178 lines (153 loc) Β· 5.92 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
name: Build Drum Midi Remapper (Windows/macOS)
on:
push:
tags:
- 'v*.*.*'
pull_request:
branches: [ main ]
permissions:
contents: write
jobs:
version:
name: π·οΈ Generate Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: π·οΈ Generate semantic version from Git tag
id: set-version
run: |
TAG=$(git describe --tags --abbrev=0)
VERSION_BASE=${TAG#v}
COUNT=$(git rev-list --count ${TAG}..HEAD)
VERSION="$VERSION_BASE.$COUNT"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "π¦ Using version: $VERSION"
build-windows:
name: Build Windows Desktop + CLI
runs-on: windows-latest
needs: version
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Install MAUI workloads
run: |
dotnet workload update
dotnet workload install maui
dotnet workload install maui-windows
- name: Restore dependencies
run: dotnet restore
- name: Build Windows MSIX
run: |
dotnet publish ./src/GUI/GUI.csproj -f net8.0-windows10.0.19041.0 -c Release `
-p:Version=${{ needs.version.outputs.version }} `
-p:WindowsPackageType=MSIX `
-p:GenerateAppxPackageOnBuild=true
- name: Build CLI
run: dotnet publish ./src/CLI/CLI.csproj -c Release -r win-x64 --self-contained true -p:Version=${{ needs.version.outputs.version }} -o ./cli-publish
- name: Package Windows MSIX
shell: pwsh
run: |
$msix = Get-ChildItem -Path ./src/GUI/bin/Release/** -Recurse -Include "*.msix" | Select-Object -First 1
Compress-Archive -Path $msix.FullName -DestinationPath DrumMidiRemapper-Windows-${{ needs.version.outputs.version }}.zip
- uses: actions/upload-artifact@v4
with:
name: DrumMidiRemapper-Windows-${{ needs.version.outputs.version }}
path: |
DrumMidiRemapper-Windows-${{ needs.version.outputs.version }}.zip
./cli-publish/**
build-macos:
name: Build macOS Desktop + CLI
runs-on: macos-latest
needs: version
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest'
- name: Install MAUI workloads
run: |
dotnet workload update
dotnet workload install maui
dotnet workload install maui-maccatalyst
- name: Restore dependencies
run: dotnet workload restore
- name: Build MacCatalyst App
run: dotnet publish ./src/GUI/GUI.csproj -f net8.0-maccatalyst -c Release -p:Version=${{ needs.version.outputs.version }}
- name: Create DMG Installer
run: |
brew install create-dmg
APP_PATH=$(find ./src/GUI/bin/Release/net8.0-maccatalyst -name "*.app" | head -n 1)
echo "Found app: $APP_PATH"
if [[ "$APP_PATH" == *" "* ]]; then
APP_DIR=$(dirname "$APP_PATH")
APP_NEW="$APP_DIR/DrumMidiRemapper.app"
echo "Renaming app to: $APP_NEW"
mv "$APP_PATH" "$APP_NEW"
APP_PATH="$APP_NEW"
fi
create-dmg \
--volname "DrumMidiRemapper" \
--window-pos 200 120 \
--window-size 600 400 \
--no-internet-enable \
--skip-jenkins \
--icon-size 100 \
--icon "$APP_PATH" 175 190 \
--app-drop-link 425 190 \
"DrumMidiRemapper-${{ needs.version.outputs.version }}.dmg" \
"$APP_PATH"
- name: Build CLI
run: dotnet publish ./src/CLI/CLI.csproj -c Release -r osx-x64 --self-contained true -p:Version=${{ needs.version.outputs.version }} -o ./cli-publish
- uses: actions/upload-artifact@v4
with:
name: DrumMidiRemapper-macOS-${{ needs.version.outputs.version }}
path: |
DrumMidiRemapper-${{ needs.version.outputs.version }}.dmg
./cli-publish/**
release:
name: π Publish GitHub Release
runs-on: ubuntu-latest
needs: [build-windows, build-macos, version]
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./artifacts
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.version.outputs.version }}
release_name: "Drum Midi Remapper v${{ needs.version.outputs.version }}"
draft: false
prerelease: false
- name: Upload Windows Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/DrumMidiRemapper-Windows-${{ needs.version.outputs.version }}/DrumMidiRemapper-Windows-${{ needs.version.outputs.version }}.zip
asset_name: DrumMidiRemapper-Windows-${{ needs.version.outputs.version }}.zip
asset_content_type: application/zip
- name: Upload macOS Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/DrumMidiRemapper-macOS-${{ needs.version.outputs.version }}/DrumMidiRemapper-${{ needs.version.outputs.version }}.dmg
asset_name: DrumMidiRemapper-macOS-${{ needs.version.outputs.version }}.dmg
asset_content_type: application/x-apple-diskimage