-
Notifications
You must be signed in to change notification settings - Fork 81
222 lines (188 loc) · 6.88 KB
/
Copy pathrelease.yml
File metadata and controls
222 lines (188 loc) · 6.88 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
213
214
215
216
217
218
219
220
221
222
name: Create Release
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
get-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Extract version from Cargo.toml
id: get_version
run: |
VERSION=$(grep '^version' ./RustApp/Cargo.toml | head -n 1 | awk -F '"' '{print $2}')
echo "version=$VERSION" >> $GITHUB_OUTPUT
build-app:
name: Build Rust App
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
- os: windows-latest
platform: windows
- os: macos-latest
platform: macos
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: taiki-e/install-action@just
- name: Install dependencies (Linux)
if: matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev libjack-jackd2-dev libpipewire-0.3-dev libpulse-dev libxkbcommon-dev protobuf-compiler
- name: Install dependencies (Windows)
if: matrix.platform == 'windows'
run: choco install protoc -y
- name: Install dependencies (macOS)
if: matrix.platform == 'macos'
run: brew install protobuf --quiet
- name: Install Rust toolchain
run: |
rustup toolchain install stable --profile minimal
if [[ "${{ matrix.platform }}" == "linux" ]]; then
rustup target add x86_64-unknown-linux-gnu
rustup component add rust-src --toolchain stable
elif [[ "${{ matrix.platform }}" == "windows" ]]; then
rustup target add i686-pc-windows-msvc x86_64-pc-windows-msvc
elif [[ "${{ matrix.platform }}" == "macos" ]]; then
rustup target add aarch64-apple-darwin x86_64-apple-darwin
fi
shell: bash
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "./RustApp -> target"
- name: Install cargo-packager
run: cargo install cargo-packager --locked
- name: Package (Linux)
if: matrix.platform == 'linux'
working-directory: ./RustApp
run: |
just build-release --target x86_64-unknown-linux-gnu
cargo packager -r -f appimage --target x86_64-unknown-linux-gnu
- name: Package (Windows)
if: matrix.platform == 'windows'
working-directory: ./RustApp
run: |
just build-release --target x86_64-pc-windows-msvc
cargo packager -r -f nsis --target x86_64-pc-windows-msvc
just build-release --target i686-pc-windows-msvc
cargo packager -r -f nsis --target i686-pc-windows-msvc
- name: Package (macOS)
if: matrix.platform == 'macos'
working-directory: ./RustApp
run: |
just build-release --target x86_64-apple-darwin
cargo packager -r -f dmg --target x86_64-apple-darwin
just build-release --target aarch64-apple-darwin
cargo packager -r -f dmg --target aarch64-apple-darwin
# For Linux
- name: Upload Linux binary
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v7
with:
name: androidmic-linux
path: ./RustApp/target/x86_64-unknown-linux-gnu/release/*.AppImage
if-no-files-found: warn
# For Windows
- name: Upload Windows built files
if: matrix.platform == 'windows'
uses: actions/upload-artifact@v7
with:
name: androidmic-windows
path: |
./RustApp/target/x86_64-pc-windows-msvc/release/*setup.exe
./RustApp/target/i686-pc-windows-msvc/release/*setup.exe
if-no-files-found: warn
# For macOS
- name: Upload macOS built files
if: matrix.platform == 'macos'
uses: actions/upload-artifact@v7
with:
name: androidmic-macos
path: |
./RustApp/target/x86_64-apple-darwin/release/*.dmg
./RustApp/target/aarch64-apple-darwin/release/*.dmg
if-no-files-found: warn
build-android:
name: Build Android App
needs: get-version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: "21"
distribution: "temurin"
cache: gradle
- name: Build Release APK
env:
KEY_BASE64: ${{ secrets.KEY_BASE64 }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
STORE_PASSWORD: ${{ secrets.KEY_PASSWORD }}
working-directory: ./Android
run: |
echo $KEY_BASE64 | base64 --decode > app/key.jks
./gradlew assembleRelease
- name: List APK files
working-directory: ./Android
run: find app/build/outputs -name "*.apk"
- name: Rename apk
working-directory: ./Android
run: mv app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/AndroidMic_${{ needs.get-version.outputs.version }}.apk
- name: Upload Android APK
uses: actions/upload-artifact@v7
with:
name: androidmic-android-apk
path: ./Android/app/build/outputs/apk/release/*.apk
if-no-files-found: warn
create-release:
name: Create GitHub Release
needs: [build-app, build-android, get-version]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Download all artifacts
uses: actions/download-artifact@v8
with:
merge-multiple: true
path: all-artifacts
- name: Display structure of downloaded files
run: find all-artifacts -type f | sort
- name: Create Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ needs.get-version.outputs.version }}
name: Release v${{ needs.get-version.outputs.version }}
draft: true
generate_release_notes: true
files: all-artifacts/**/*
body: |
## AndroidMic v${{ needs.get-version.outputs.version }}
### Release Notes
<!-- You can add manual notes here, they will be combined with automated notes -->
- Several improvements and bug fixed
### Installation
- For Android: Install the `.apk` file
- For Linux: Download and run the `.AppImage` binary
- For Windows: Download and run the `.exe` installer
- For macOS: Download and run the `.dmg` file