Add Release Workflow (#6) #29
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |