Skip to content

Commit dc3ece6

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

8 files changed

Lines changed: 316 additions & 216 deletions

File tree

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

0 commit comments

Comments
 (0)