ci: update desktop build workflow and artifact naming #14
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 Desktop Distributions | ||
|
Check failure on line 1 in .github/workflows/build-desktop.yml
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' # Runs on version tags like v1.0.0 | ||
| jobs: | ||
| build: | ||
| name: Build for ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| # macOS ARM (Apple Silicon) | ||
| - os: macos-latest | ||
| format: macos-arm | ||
| arch_label: macos-arm64 | ||
| # macOS Intel (x64) | ||
| - os: macos-15-intel | ||
| format: macos-intel | ||
| arch_label: macos-x64 | ||
| # Windows | ||
| - os: windows-latest | ||
| format: windows | ||
| arch_label: windows-x64 | ||
| # Linux | ||
| - os: ubuntu-latest | ||
| format: linux | ||
| arch_label: linux-amd64 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
| - name: Grant execute permission for Gradlew | ||
| if: runner.os != 'Windows' | ||
| run: chmod +x gradlew | ||
| - name: Inject release props | ||
| shell: bash | ||
| env: | ||
| SENTRY_DNS: ${{ secrets.SENTRY_DNS }} | ||
| run: | | ||
| VERSION=${GITHUB_REF_NAME#v} | ||
| echo "is_release=true" > desktopApp/src/jvmMain/resources/props.properties | ||
| echo "sentry_dns=$SENTRY_DNS" >> desktopApp/src/jvmMain/resources/props.properties | ||
| echo "version=$VERSION" >> desktopApp/src/jvmMain/resources/props.properties | ||
| - name: Build native packages | ||
| run: ./gradlew packageReleaseDistributionForCurrentOS --stacktrace | ||
| # macOS ARM | ||
| - name: Rename macOS ARM DMG | ||
| if: matrix.format == 'macos-arm' | ||
| run: | | ||
| FILE=$(find composeApp/build/compose/binaries -name "*.dmg") | ||
| VERSION=${GITHUB_REF_NAME#v} | ||
| mv "$FILE" "$(dirname "$FILE")/DevAnalyzer-$VERSION-macos-arm64.dmg" | ||
| # macOS Intel | ||
| - name: Rename macOS Intel DMG | ||
| if: matrix.format == 'macos-intel' | ||
| run: | | ||
| FILE=$(find composeApp/build/compose/binaries -name "*.dmg") | ||
| VERSION=${GITHUB_REF_NAME#v} | ||
| mv "$FILE" "$(dirname "$FILE")/DevAnalyzer-$VERSION-macos-x64.dmg" | ||
| # Windows | ||
| - name: Rename Windows MSI | ||
| if: matrix.format == 'windows' | ||
| shell: pwsh | ||
| run: | | ||
| $version = $env:GITHUB_REF_NAME.Replace("v","") | ||
| $file = Get-ChildItem -Recurse -Filter *.msi composeApp/build/compose/binaries | Select-Object -First 1 | ||
| Rename-Item $file.FullName "DevAnalyzer-$version-windows-x64.msi" | ||
| # Linux | ||
| - name: Rename Linux DEB | ||
| if: matrix.format == 'linux' | ||
| run: | | ||
| FILE=$(find composeApp/build/compose/binaries -name "*.deb") | ||
| VERSION=${GITHUB_REF_NAME#v} | ||
| mv "$FILE" "$(dirname "$FILE")/DevAnalyzer-$VERSION-linux-amd64.deb" | ||
| # Upload renamed artifacts | ||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build-${{ matrix.format }} | ||
| path: | | ||
| composeApp/build/compose/binaries/**/dmg/*.dmg | ||
| composeApp/build/compose/binaries/**/deb/*.deb | ||
| composeApp/build/compose/binaries/**/msi/*.msi | ||
| release: | ||
| name: Create GitHub Release | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Download build artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| path: ./artifacts | ||
| - name: List downloaded files | ||
| run: ls -R ./artifacts | ||
| - name: Upload to GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| files: | | ||
| artifacts/build-macos-arm/**/*.dmg | ||
| artifacts/build-macos-intel/**/*.dmg | ||
| artifacts/build-windows/**/*.msi | ||
| artifacts/build-linux/**/*.deb | ||
| draft: true | ||
| tag_name: ${{ github.ref_name }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secretssecrets.GITHUB_TOKEN }} | ||