Skip to content

Commit db5e029

Browse files
fix(newm-admin): Fix AppImage icon on Linux
1 parent ee24dab commit db5e029

File tree

12 files changed

+496
-252
lines changed

12 files changed

+496
-252
lines changed
Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,274 @@
1+
# Release workflow for NEWM Admin - runs only on version tags (v*)
2+
# For CI on PRs/pushes, see newm-admin.yml
3+
4+
on:
5+
push:
6+
tags:
7+
- 'v*'
8+
9+
name: NEWM Admin Release
10+
11+
jobs:
12+
build:
13+
name: Build
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
job:
18+
- { os: ubuntu-24.04, label: ubuntu24, target: x86_64-unknown-linux-gnu }
19+
- { os: macos-latest, label: macos, target: aarch64-apple-darwin }
20+
- { os: windows-latest, label: windows, target: x86_64-pc-windows-msvc }
21+
rust: [ stable ]
22+
23+
runs-on: ${{ matrix.job.os }}
24+
25+
defaults:
26+
run:
27+
working-directory: newm-admin
28+
29+
steps:
30+
- name: Checkout sources
31+
uses: actions/checkout@v4
32+
33+
- name: Install stable toolchain
34+
uses: dtolnay/rust-toolchain@stable
35+
with:
36+
toolchain: stable
37+
components: rustfmt, clippy
38+
39+
- name: Setup Rust cache
40+
uses: Swatinem/rust-cache@v2
41+
with:
42+
workspaces: "newm-admin -> target"
43+
44+
- name: Install Linux dependencies
45+
if: runner.os == 'Linux'
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y libxkbcommon-x11-dev libxkbcommon-dev libwayland-dev libfuse2
49+
50+
- name: Run cargo check
51+
if: ${{ matrix.job.target == 'x86_64-unknown-linux-gnu' }}
52+
run: cargo check
53+
54+
- name: Run cargo fmt
55+
if: ${{ matrix.job.target == 'x86_64-unknown-linux-gnu' }}
56+
run: cargo fmt --all -- --check
57+
58+
- name: Run cargo clippy
59+
run: cargo clippy --release --target ${{ matrix.job.target }} -- -D warnings
60+
61+
- name: Run cargo test
62+
run: cargo test --release --target ${{ matrix.job.target }}
63+
64+
- name: Build Release
65+
run: cargo build --release --target ${{ matrix.job.target }} --locked
66+
67+
- name: Package (basic archive)
68+
id: package
69+
shell: bash
70+
run: |
71+
PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml)
72+
PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
73+
if [[ "${{ matrix.job.target }}" == *-pc-windows-* ]]; then
74+
PKG_SUFFIX=".zip"
75+
else
76+
PKG_SUFFIX=".tar.gz"
77+
fi
78+
PKG_NAME=${PROJECT_NAME}-${PROJECT_VERSION}-${{ matrix.job.label }}-${{ matrix.job.target }}${PKG_SUFFIX}
79+
80+
if [[ "${{ matrix.job.target }}" == *-pc-windows-* ]]; then
81+
7z -y a "${PKG_NAME}" ./target/${{matrix.job.target}}/release/newm-admin.exe | tail -2
82+
else
83+
tar -C target/${{matrix.job.target}}/release -czf "${PKG_NAME}" newm-admin
84+
fi
85+
86+
echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT
87+
echo "PKG_PATH=${PKG_NAME}" >> $GITHUB_OUTPUT
88+
echo "PROJECT_VERSION=${PROJECT_VERSION}" >> $GITHUB_OUTPUT
89+
90+
- name: Upload Artifacts (basic archive)
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: ${{ steps.package.outputs.PKG_NAME }}
94+
path: newm-admin/${{ steps.package.outputs.PKG_PATH }}
95+
96+
package-macos:
97+
name: Package macOS DMG
98+
needs: build
99+
runs-on: macos-latest
100+
101+
defaults:
102+
run:
103+
working-directory: newm-admin
104+
105+
steps:
106+
- name: Checkout sources
107+
uses: actions/checkout@v4
108+
109+
- name: Install stable toolchain
110+
uses: dtolnay/rust-toolchain@stable
111+
with:
112+
toolchain: stable
113+
114+
- name: Setup Rust cache
115+
uses: Swatinem/rust-cache@v2
116+
with:
117+
workspaces: "newm-admin -> target"
118+
119+
- name: Install create-dmg
120+
run: brew install create-dmg
121+
122+
- name: Build Release
123+
run: cargo build --release --target aarch64-apple-darwin --locked
124+
125+
- name: Get version
126+
id: version
127+
run: |
128+
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
129+
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
130+
131+
- name: Create DMG
132+
run: |
133+
chmod +x packaging/macos/bundle.sh
134+
packaging/macos/bundle.sh ${{ steps.version.outputs.VERSION }} aarch64-apple-darwin
135+
136+
- name: Upload DMG
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: NEWM-Admin-${{ steps.version.outputs.VERSION }}-macos.dmg
140+
path: newm-admin/target/aarch64-apple-darwin/release/NEWM-Admin-${{ steps.version.outputs.VERSION }}-macos.dmg
141+
142+
package-linux:
143+
name: Package Linux AppImage
144+
needs: build
145+
runs-on: ubuntu-22.04
146+
147+
defaults:
148+
run:
149+
working-directory: newm-admin
150+
151+
steps:
152+
- name: Checkout sources
153+
uses: actions/checkout@v4
154+
155+
- name: Install stable toolchain
156+
uses: dtolnay/rust-toolchain@stable
157+
with:
158+
toolchain: stable
159+
160+
- name: Setup Rust cache
161+
uses: Swatinem/rust-cache@v2
162+
with:
163+
workspaces: "newm-admin -> target"
164+
165+
- name: Install Linux dependencies
166+
run: |
167+
sudo apt-get update
168+
sudo apt-get install -y libxkbcommon-x11-dev libxkbcommon-dev libwayland-dev libfuse2
169+
170+
- name: Build Release
171+
run: cargo build --release --target x86_64-unknown-linux-gnu --locked
172+
173+
- name: Get version
174+
id: version
175+
run: |
176+
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
177+
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
178+
179+
- name: Create AppImage
180+
run: |
181+
chmod +x packaging/linux/build-appimage.sh
182+
packaging/linux/build-appimage.sh ${{ steps.version.outputs.VERSION }} x86_64-unknown-linux-gnu
183+
184+
- name: Upload AppImage
185+
uses: actions/upload-artifact@v4
186+
with:
187+
name: NEWM-Admin-${{ steps.version.outputs.VERSION }}-x86_64.AppImage
188+
path: newm-admin/target/x86_64-unknown-linux-gnu/release/NEWM-Admin-${{ steps.version.outputs.VERSION }}-x86_64.AppImage
189+
190+
package-windows:
191+
name: Package Windows MSI
192+
needs: build
193+
runs-on: windows-latest
194+
195+
defaults:
196+
run:
197+
working-directory: newm-admin
198+
199+
steps:
200+
- name: Checkout sources
201+
uses: actions/checkout@v4
202+
203+
- name: Install stable toolchain
204+
uses: dtolnay/rust-toolchain@stable
205+
with:
206+
toolchain: stable
207+
208+
- name: Setup Rust cache
209+
uses: Swatinem/rust-cache@v2
210+
with:
211+
workspaces: "newm-admin -> target"
212+
213+
- name: Install WiX Toolset
214+
run: |
215+
dotnet tool install --global wix
216+
cargo install cargo-wix
217+
218+
- name: Build Release
219+
run: cargo build --release --target x86_64-pc-windows-msvc --locked
220+
221+
- name: Get version
222+
id: version
223+
shell: bash
224+
run: |
225+
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)
226+
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
227+
228+
- name: Build MSI
229+
shell: pwsh
230+
run: |
231+
./packaging/windows/build-msi.ps1 -Version "${{ steps.version.outputs.VERSION }}" -Target "x86_64-pc-windows-msvc"
232+
233+
- name: Upload MSI
234+
uses: actions/upload-artifact@v4
235+
with:
236+
name: NEWM-Admin-${{ steps.version.outputs.VERSION }}-windows.msi
237+
path: newm-admin/target/x86_64-pc-windows-msvc/release/NEWM-Admin-${{ steps.version.outputs.VERSION }}-windows.msi
238+
239+
release:
240+
name: Create Release
241+
needs: [package-macos, package-linux, package-windows]
242+
runs-on: ubuntu-latest
243+
244+
steps:
245+
- name: Checkout sources
246+
uses: actions/checkout@v4
247+
248+
- name: Get version
249+
id: version
250+
run: |
251+
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' newm-admin/Cargo.toml | head -n1)
252+
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
253+
254+
- name: Download all artifacts
255+
uses: actions/download-artifact@v4
256+
with:
257+
path: artifacts
258+
259+
- name: List artifacts
260+
run: find artifacts -type f
261+
262+
- name: Create Release
263+
uses: softprops/action-gh-release@v2
264+
with:
265+
name: NEWM Admin v${{ steps.version.outputs.VERSION }}
266+
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
267+
files: |
268+
artifacts/**/*.dmg
269+
artifacts/**/*.AppImage
270+
artifacts/**/*.msi
271+
artifacts/**/*.tar.gz
272+
artifacts/**/*.zip
273+
env:
274+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)