1- name : Build Linux App (Rust)
1+ name : Linux Build & Release
22
33on :
44 push :
55 branches :
6- - linux-rust
6+ - linux/rust
7+ tags :
8+ - ' linux-v*'
9+ paths :
10+ - ' linux-rust/**'
11+ - ' .github/workflows/linux-build.yml'
712 workflow_dispatch :
813
914jobs :
1015 build :
1116 runs-on : ubuntu-latest
1217
1318 steps :
14- - name : Checkout
15- uses : actions/checkout@v4
19+ - uses : actions/checkout@v4
1620
1721 - name : Install dependencies
18- run : sudo apt-get update && sudo apt-get install -y libdbus-1-dev pkg-config libpulse-dev
22+ run : |
23+ sudo apt-get update
24+ sudo apt-get install -y pkg-config libdbus-1-dev libpulse-dev appstream just
25+
26+ - name : Install AppImage tools
27+ run : |
28+ wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /usr/local/bin/appimagetool
29+ wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O /usr/local/bin/linuxdeploy
30+ chmod +x /usr/local/bin/{appimagetool,linuxdeploy}
1931
2032 - name : Install Rust
2133 uses : dtolnay/rust-toolchain@stable
@@ -26,15 +38,58 @@ jobs:
2638 path : |
2739 ~/.cargo/registry
2840 ~/.cargo/git
29- target
30- key : ${{ runner.os }}-cargo-${{ hashFiles('** /Cargo.lock') }}
41+ linux-rust/ target
42+ key : ${{ runner.os }}-cargo-${{ hashFiles('linux-rust /Cargo.lock') }}
3143
32- - name : Build release binary
44+ - name : Build AppImage and Binary
3345 working-directory : linux-rust
34- run : cargo build --release --verbose
46+ run : |
47+ cargo build --release --verbose
48+ just
49+ mkdir -p dist
50+ cp target/release/librepods-rust dist/librepods
51+ mv dist/LibrePods-x86_64.AppImage dist/librepods-x86_64.AppImage
3552
36- - name : Upload build artifact
53+ - name : Upload build artifacts
54+ if : " !startsWith(github.ref, 'refs/tags/linux-v')"
3755 uses : actions/upload-artifact@v4
3856 with :
39- name : librepods-rust
40- path : linux-rust/target/release/librepods-rust
57+ name : LibrePods-Build
58+ path : |
59+ linux-rust/dist/librepods
60+ linux-rust/dist/librepods-x86_64.AppImage
61+
62+ - name : Vendor and create tarball
63+ if : startsWith(github.ref, 'refs/tags/linux-v')
64+ working-directory : linux-rust
65+ run : |
66+ cargo vendor vendor
67+ mkdir -p dist .cargo
68+ cat > .cargo/config.toml <<'EOF'
69+ [source.crates-io]
70+ replace-with = "vendored-sources"
71+ [source.vendored-sources]
72+ directory = "vendor"
73+ EOF
74+
75+ VERSION="${GITHUB_REF_NAME#linux-v}"
76+ TAR="librepods-v${VERSION}-source.tar.gz"
77+ tar -czf "dist/${TAR}" \
78+ --transform "s,^,librepods-v${VERSION}/," \
79+ Cargo.toml Cargo.lock src vendor .cargo assets flatpak
80+
81+ echo "VERSION=${VERSION}" >> $GITHUB_ENV
82+ echo "TAR_PATH=linux-rust/dist/${TAR}" >> $GITHUB_ENV
83+
84+ - name : Create GitHub Release (AppImage + binary + source)
85+ if : startsWith(github.ref, 'refs/tags/linux-v')
86+ uses : softprops/action-gh-release@v2
87+ with :
88+ tag_name : ${{ github.ref_name }}
89+ files : |
90+ linux-rust/dist/librepods-v${{ env.VERSION }}-source.tar.gz
91+ linux-rust/dist/librepods-x86_64.AppImage
92+ linux-rust/dist/librepods
93+ generate_release_notes : true
94+ env :
95+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments