-
Notifications
You must be signed in to change notification settings - Fork 0
238 lines (202 loc) · 6.69 KB
/
build-apps.yml
File metadata and controls
238 lines (202 loc) · 6.69 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
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
name: Build Apps
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: write
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
jobs:
build:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu
arch: amd64
target: x86_64-unknown-linux-gnu
- os: macos
arch: arm64
target: aarch64-apple-darwin
- os: windows
arch: amd64
target: x86_64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install system dependencies
if: matrix.os == 'ubuntu'
run: sudo apt-get update -y && sudo apt-get install -y libglib2.0-dev libgtk-3-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install Windows targets
if: matrix.os == 'windows'
run: rustup target add ${{ matrix.target }}
- name: Install Cross
if: matrix.os == 'ubuntu'
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build binary (Linux)
if: matrix.os == 'ubuntu'
run: cross build --release --target ${{ matrix.target }}
- name: Build binary (macOS/Windows)
if: matrix.os == 'macos' || matrix.os == 'windows'
run: cargo build --release --target ${{ matrix.target }}
- name: Upload build artifacts
uses: actions/upload-artifact@v5
with:
name: build-${{ matrix.os }}-${{ matrix.target }}
path: |
target/${{ matrix.target }}/release/buddy-up-iced
target/${{ matrix.target }}/release/buddy-up-iced.exe
if-no-files-found: error
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [dmg, msi]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Download all artifacts
uses: actions/download-artifact@v6
with:
path: release-artifacts
- name: List downloaded artifacts
run: ls -al release-artifacts
- name: Generate release notes
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --latest --strip header
env:
OUTPUT: RELEASE_NOTES.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE_NOTES.md
files: |
release-artifacts/**/*.msi
release-artifacts/**/*.dmg
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
dmg:
runs-on: macos-latest
needs: build
strategy:
fail-fast: true
matrix:
include:
- arch: AppleSilicon
target: aarch64-apple-darwin
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Install packaging tools
run: |
cargo install toml-cli
brew install create-dmg
- uses: actions/download-artifact@v6
with:
name: build-macos-${{ matrix.target }}
path: target/
- name: Package for macOS
shell: bash
run: |
VERSION=$(toml get Cargo.toml workspace.package.version --raw)
echo $VERSION
sed -i'.bak' -e "s/0\.0\.0/${VERSION}/g" -e "s/fffffff/${GITHUB_SHA:0:7}/g" resources/Info.plist
mkdir artifacts
mkdir -p target/release/bundle/osx/BuddyUp.app/Contents/{MacOS,Resources}
cp resources/Info.plist \
target/release/bundle/osx/BuddyUp.app/Contents/
cp resources/icon.icns \
target/release/bundle/osx/BuddyUp.app/Contents/Resources/
ls -la
ls -la target
chmod +x target/buddy-up-iced
cp target/buddy-up-iced target/release/bundle/osx/BuddyUp.app/Contents/MacOS/
create-dmg \
--volname "BuddyUp Installer" \
--window-pos 200 120 \
--window-size 900 450 \
--icon-size 100 \
--app-drop-link 620 240 \
--icon "BuddyUp.app" 300 240 \
--hide-extension "BuddyUp.app" \
"artifacts/BuddyUp_macOS_${{ matrix.arch }}.dmg" \
"target/release/bundle/osx/"
- name: Upload package artifacts
uses: actions/upload-artifact@v5
with:
name: dmg-${{ matrix.arch }}
path: artifacts/
if-no-files-found: error
msi:
runs-on: windows-latest
needs: build
strategy:
fail-fast: true
matrix:
include:
- arch: 64-bit
target: x86_64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install dependencies
shell: powershell
run: |
Write-Host "::group::WiX Toolset"
Invoke-WebRequest `
-Uri "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip" `
-OutFile "$env:TEMP\wix-binaries.zip" -Verbose
Expand-Archive -LiteralPath "$env:TEMP\wix-binaries.zip" -DestinationPath "$env:TEMP\wix" -Verbose
Set-Item -Path env:Path -Value "$env:Path;$env:TEMP\wix"
Write-Host "::endgroup::"
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install packaging tools
run: cargo install cargo-wix
- uses: actions/download-artifact@v6
with:
name: build-windows-${{ matrix.target }}
path: target/
- name: Package for Microsoft Windows
shell: powershell
run: |
New-Item -ItemType Directory -Path artifacts
cargo wix --no-build --name buddy-up --package buddy-up-iced --nocapture --target ${{ matrix.target }}
Move-Item -Path target\wix\buddy-up*.msi -Destination .\artifacts\BuddyUp_Windows_${{ matrix.arch }}.msi
- name: Upload package artifacts
uses: actions/upload-artifact@v5
with:
name: msi-${{ matrix.arch }}
path: artifacts/
if-no-files-found: error