@@ -26,105 +26,80 @@ jobs:
2626 target : x86_64-pc-windows-msvc
2727 - os : windows-2019
2828 target : aarch64-pc-windows-msvc
29-
3029 runs-on : ${{ matrix.os }}
3130 steps :
3231 - uses : actions/checkout@v4
3332
3433 - name : Install Dependencies (Linux)
3534 if : contains(matrix.os, 'ubuntu')
36- run : |
37- sudo apt-get update
38- sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev \
39- libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev \
40- libudev-dev cmake
41- cargo install cargo-bundle
35+ run : sudo apt-get update && sudo apt-get install -y libclang-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev libudev-dev && cargo install cargo-bundle
4236
4337 - name : Install Dependencies (macOS)
4438 if : contains(matrix.os, 'macos')
45- run : |
46- brew install cmake
47- cargo install cargo-bundle
39+ run : cargo install cargo-bundle
4840
4941 - name : Install Dependencies (Windows)
5042 if : contains(matrix.os, 'windows')
51- run : |
52- cargo install --force cargo-wix
53- choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
43+ run : cargo install --force cargo-wix
5444
55- - name : Set CARGO_FEATURES (Windows)
45+ - name : Set CARGO_FEATURES environment variable (Windows)
5646 if : contains(matrix.os, 'windows')
57- run : echo "CARGO_FEATURES=self_update" >> $env:GITHUB_ENV
47+ run : |
48+ echo "CARGO_FEATURES=self_update" >> $env:GITHUB_ENV
5849
5950 - name : Build
60- run : |
61- rustup target add ${{ matrix.target }}
62- cargo build --release --features self_update --target ${{ matrix.target }}
51+ run : cargo build --features self_update --release
6352
6453 - name : Build .deb Package (Linux)
6554 if : contains(matrix.os, 'ubuntu')
66- run : cargo bundle --features self_update --release --target ${{ matrix.target }}
55+ run : cargo bundle --features self_update --release
6756
6857 - name : Build .app Package (macOS)
6958 if : contains(matrix.os, 'macos')
70- run : cargo bundle --features self_update --release --target ${{ matrix.target }}
59+ run : cargo bundle --features self_update --release
7160
7261 - name : Build .msi Package (Windows)
7362 if : contains(matrix.os, 'windows')
7463 run : cargo wix
7564
65+ # Compress for Linux Binary
7666 - name : Compress Output (Linux Binary)
7767 if : contains(matrix.os, 'ubuntu')
7868 run : |
79- BIN_DIR="target/${{ matrix.target }}/release"
80- [ -d "$BIN_DIR" ] || BIN_DIR="target/release"
81- cd "$BIN_DIR"
69+ cd target/release
8270 zip -r serial-monitor-${{ matrix.target }}.zip serial-monitor-rust
8371 mv serial-monitor-${{ matrix.target }}.zip $GITHUB_WORKSPACE/
8472
73+ # Compress for Linux .deb Package
8574 - name : Compress Output (Linux .deb)
8675 if : contains(matrix.os, 'ubuntu')
8776 run : |
88- DEB_DIR="target/${{ matrix.target }}/release/bundle/deb"
89- [ -d "$DEB_DIR" ] || DEB_DIR="target/release/bundle/deb"
90- cd "$DEB_DIR"
77+ cd target/release/bundle/deb
9178 zip serial-monitor-${{ matrix.target }}.deb.zip *.deb
9279 mv serial-monitor-${{ matrix.target }}.deb.zip $GITHUB_WORKSPACE/
9380
94- - name : Compress Output (macOS .app)
81+ # Compress for macOS (.app Bundle)
82+ - name : Compress Output (macOS)
9583 if : contains(matrix.os, 'macos')
9684 run : |
97- OSX_DIR="target/${{ matrix.target }}/release/bundle/osx"
98- [ -d "$OSX_DIR" ] || OSX_DIR="target/release/bundle/osx"
99- cd "$OSX_DIR"
85+ cd target/release/bundle/osx
10086 zip -r serial-monitor-${{ matrix.target }}.app.zip Serial\ Monitor.app
10187 mv serial-monitor-${{ matrix.target }}.app.zip $GITHUB_WORKSPACE/
10288
89+ # Compress for Windows (.exe)
10390 - name : Compress Output (Windows .exe)
10491 if : contains(matrix.os, 'windows')
105- shell : pwsh
10692 run : |
107- $exePath1 = "target/${{ matrix.target }}/release/serial-monitor-rust.exe"
108- $exePath2 = "target/release/serial-monitor-rust.exe"
109- $exePath = if (Test-Path $exePath1) { $exePath1 } elseif (Test-Path $exePath2) { $exePath2 } else { "" }
110- if ($exePath -eq "") {
111- Write-Error "Executable not found"
112- exit 1
113- }
114- Compress-Archive -Path $exePath -DestinationPath "serial-monitor-${{ matrix.target }}.exe.zip"
115- Move-Item -Path "serial-monitor-${{ matrix.target }}.exe.zip" -Destination $env:GITHUB_WORKSPACE
93+ Compress-Archive -Path target/release/serial-monitor-rust.exe -DestinationPath serial-monitor-${{ matrix.target }}.exe.zip
94+ Move-Item -Path serial-monitor-${{ matrix.target }}.exe.zip -Destination $env:GITHUB_WORKSPACE
11695
96+ # Compress for Windows (.msi)
11797 - name : Compress Output (Windows .msi)
11898 if : contains(matrix.os, 'windows')
119- shell : pwsh
12099 run : |
121- $msiPath = Get-ChildItem -Path "target/wix" -Filter "*.msi" | Select-Object -First 1
122- if (-Not $msiPath) {
123- Write-Error "MSI not found"
124- exit 1
125- }
126- Compress-Archive -Path $msiPath.FullName -DestinationPath "serial-monitor-${{ matrix.target }}.msi.zip"
127- Move-Item -Path "serial-monitor-${{ matrix.target }}.msi.zip" -Destination $env:GITHUB_WORKSPACE
100+ cd target/wix
101+ Compress-Archive -Path *.msi -DestinationPath serial-monitor-${{ matrix.target }}.msi.zip
102+ Move-Item -Path serial-monitor-${{ matrix.target }}.msi.zip -Destination $env:GITHUB_WORKSPACE
128103
129104 - name : Upload .deb and executable for Linux (Ubuntu)
130105 if : contains(matrix.os, 'ubuntu')
0 commit comments