-
-
Notifications
You must be signed in to change notification settings - Fork 6
140 lines (120 loc) · 4.26 KB
/
build-desktop.yml
File metadata and controls
140 lines (120 loc) · 4.26 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
name: Build Desktop Distributions
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 21
uses: actions/setup-java@v5
with:
distribution: 'jetbrains'
java-version: '21'
- 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: |
MAJOR=$(grep "MAJOR=" version.properties | cut -d'=' -f2)
MINOR=$(grep "MINOR=" version.properties | cut -d'=' -f2)
PATCH=$(grep "PATCH=" version.properties | cut -d'=' -f2)
VERSION="$MAJOR.$MINOR.$PATCH"
echo "is_release=true" > composeApp/src/jvmMain/resources/props.properties
echo "sentry_dns=$SENTRY_DNS" >> composeApp/src/jvmMain/resources/props.properties
echo "version=$VERSION" >> composeApp/src/jvmMain/resources/props.properties
- name: Normalize version
shell: bash
run: |
RAW_TAG="${GITHUB_REF_NAME}"
VERSION="${RAW_TAG#v}"
echo "APP_VERSION=$VERSION" >> $GITHUB_ENV
- 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" -type f)
NEW="DevAnalyzer-${{ env.APP_VERSION }}-macos-arm64.dmg"
mv "$FILE" "$(dirname "$FILE")/$NEW"
# macOS Intel
- name: Rename macOS Intel DMG
if: matrix.format == 'macos-intel'
run: |
FILE=$(find composeApp/build/compose/binaries -name "*.dmg" -type f)
NEW="DevAnalyzer-${{ env.APP_VERSION }}-macos-x64.dmg"
mv "$FILE" "$(dirname "$FILE")/$NEW"
# Windows
- name: Rename Windows MSI
if: matrix.format == 'windows'
shell: pwsh
run: |
$file = Get-ChildItem -Recurse -Filter *.msi -Path "composeApp/build/compose/binaries" | Select-Object -First 1
$newName = "DevAnalyzer-${{ env.APP_VERSION }}-windows-x64.msi"
Rename-Item -Path $file.FullName -NewName $newName
# Linux
- name: Rename Linux DEB
if: matrix.format == 'linux'
run: |
FILE=$(find composeApp/build/compose/binaries -name "*.deb" -type f)
NEW="DevAnalyzer-${{ env.APP_VERSION }}-linux-amd64.deb"
mv "$FILE" "$(dirname "$FILE")/$NEW"
# 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: ${{ secrets.GITHUB_TOKEN }}