|
| 1 | +name: Linux Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - linux/rust |
| 7 | + tags: |
| 8 | + - 'linux-v*' |
| 9 | + paths: |
| 10 | + - 'linux-rust/**' |
| 11 | + - '.github/workflows/linux-build.yml' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Install dependencies |
| 22 | + run: | |
| 23 | + sudo apt-get update |
| 24 | + sudo apt-get install -y pkg-config libdbus-1-dev libpulse-dev appstream just libfuse2 |
| 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} |
| 31 | +
|
| 32 | + - name: Install Rust |
| 33 | + uses: dtolnay/rust-toolchain@stable |
| 34 | + |
| 35 | + - name: Cache Cargo |
| 36 | + uses: actions/cache@v4 |
| 37 | + with: |
| 38 | + path: | |
| 39 | + ~/.cargo/registry |
| 40 | + ~/.cargo/git |
| 41 | + linux-rust/target |
| 42 | + key: ${{ runner.os }}-cargo-${{ hashFiles('linux-rust/Cargo.lock') }} |
| 43 | + |
| 44 | + - name: Build AppImage and Binary |
| 45 | + working-directory: linux-rust |
| 46 | + run: | |
| 47 | + cargo build --release --verbose |
| 48 | + just |
| 49 | + mkdir -p dist |
| 50 | + cp target/release/librepods dist/librepods |
| 51 | + mv dist/LibrePods-x86_64.AppImage dist/librepods-x86_64.AppImage |
| 52 | +
|
| 53 | + - name: Upload AppImage artifact |
| 54 | + if: "!startsWith(github.ref, 'refs/tags/linux-v')" |
| 55 | + uses: actions/upload-artifact@v4 |
| 56 | + with: |
| 57 | + name: librepods-x86_64.AppImage |
| 58 | + path: linux-rust/dist/librepods-x86_64.AppImage |
| 59 | + |
| 60 | + - name: Upload binary artifact |
| 61 | + if: "!startsWith(github.ref, 'refs/tags/linux-v')" |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: librepods |
| 65 | + path: linux-rust/dist/librepods |
| 66 | + |
| 67 | + - name: Create tarball for Flatpak |
| 68 | + if: startsWith(github.ref, 'refs/tags/linux-v') |
| 69 | + working-directory: linux-rust |
| 70 | + run: | |
| 71 | + VERSION="${GITHUB_REF_NAME#linux-v}" |
| 72 | + just tarball "${VERSION}" |
| 73 | + echo "VERSION=${VERSION}" >> $GITHUB_ENV |
| 74 | + echo "TAR_PATH=linux-rust/dist/librepods-v${VERSION}-source.tar.gz" >> $GITHUB_ENV |
| 75 | +
|
| 76 | + - name: Create GitHub Release (AppImage + binary + source) |
| 77 | + if: startsWith(github.ref, 'refs/tags/linux-v') |
| 78 | + uses: softprops/action-gh-release@v2 |
| 79 | + with: |
| 80 | + tag_name: ${{ github.ref_name }} |
| 81 | + files: | |
| 82 | + linux-rust/dist/librepods-v${{ env.VERSION }}-source.tar.gz |
| 83 | + linux-rust/dist/librepods-x86_64.AppImage |
| 84 | + linux-rust/dist/librepods |
| 85 | + generate_release_notes: true |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments