From 95143b46fd7096458451baff851cc4596a22e99f Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Sun, 17 Dec 2023 21:02:42 +0200 Subject: [PATCH] Ubuntu (deb) packaging, version bump --- .github/workflows/release.yml | 42 ++++++++++++++++++++----- Cargo.lock | 2 +- Cargo.toml | 11 ++++++- docs/INSTALLATION.md | 16 +++++++++- res/linux/space-acres-autostart.desktop | 6 ++++ res/linux/space-acres.desktop | 2 +- 6 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 res/linux/space-acres-autostart.desktop diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be2a1511..65ec7c91 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,11 +18,11 @@ jobs: strategy: matrix: build: - # TODO: Package Linux and macOS -# - os: ubuntu-22.04 -# target: x86_64-unknown-linux-gnu -# suffix: ubuntu-x86_64-skylake-${{ github.ref_name }} -# rustflags: "-C target-cpu=skylake" + - os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + suffix: ubuntu-x86_64-skylake-${{ github.ref_name }} + rustflags: "-C target-cpu=skylake" + # TODO: Package for more Linux distributions/packaging formats/architectures and macOS # - os: ubuntu-22.04 # target: aarch64-unknown-linux-gnu # suffix: ubuntu-aarch64-${{ github.ref_name }} @@ -155,7 +155,7 @@ jobs: Remove-Item target\wix\gtk4 -Recurse -Confirm:$false -ErrorAction SilentlyContinue if: runner.os == 'Windows' - - name: Upload node and farmer executables to artifacts (Windows) + - name: Upload installer to artifacts (Windows) uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # @v3.1.1 with: name: installer-${{ matrix.build.suffix }} @@ -164,10 +164,38 @@ jobs: if-no-files-found: error if: runner.os == 'Windows' - - name: Upload node and farmer executables to assets (Windows) + - name: Upload installer to assets (Windows) uses: alexellis/upload-assets@259de5111cb56966d046ced998941e93f91d2c93 # @0.4.0 env: GITHUB_TOKEN: ${{ github.token }} with: asset_paths: '["target/wix/*.msi"]' if: runner.os == 'Windows' && github.event_name == 'push' && github.ref_type == 'tag' + + - name: Install cargo-deb (Linux) + uses: taiki-e/cache-cargo-install-action@1b76958d032c4d048c599f9fdfa48abe804d6319 # v1.2.2 + with: + tool: cargo-deb + if: runner.os == 'Linux' + + - name: Package (Linux) + run: | + cargo deb --target ${{ matrix.build.target }} --profile production --no-build --no-strip + if: runner.os == 'Linux' + + - name: Upload installer to artifacts (Linux) + uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # @v3.1.1 + with: + name: installer-${{ matrix.build.suffix }} + path: | + target/debian/*.deb + if-no-files-found: error + if: runner.os == 'Linux' + + - name: Upload installer to assets (Linux) + uses: alexellis/upload-assets@259de5111cb56966d046ced998941e93f91d2c93 # @0.4.0 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + asset_paths: '["target/debian/*.deb"]' + if: runner.os == 'Linux' && github.event_name == 'push' && github.ref_type == 'tag' diff --git a/Cargo.lock b/Cargo.lock index 708f9426..d832619a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10528,7 +10528,7 @@ dependencies = [ [[package]] name = "space-acres" -version = "0.0.6" +version = "0.0.7" dependencies = [ "anyhow", "arc-swap", diff --git a/Cargo.toml b/Cargo.toml index ba995b9d..fea5a053 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "space-acres" description = "Space Acres is an opinionated unofficial GUI application for farming on Subspace Network" license = "0BSD" -version = "0.0.6" +version = "0.0.7" authors = ["Nazar Mokrynskyi "] repository = "https://github.com/nazar-pc/space-acres" edition = "2021" @@ -11,6 +11,15 @@ include = [ "/Cargo.toml", ] +[package.metadata.deb] +section = "net" +assets = [ + ["res/linux/space-acres-autostart.desktop", "/etc/xdg/autostart/space-acres.desktop", "644"], + ["target/release/space-acres", "/usr/bin/space-acres", "755"], + ["res/linux/space-acres.desktop", "/usr/share/applications/space-acres.desktop", "644"], + ["res/linux/space-acres.png", "/usr/share/icons/hicolor/apps/space-acres.png", "644"], +] + # TODO: Menu shortcut will not be generated automatically in case of re-init: https://github.com/volks73/cargo-wix/issues/141 [package.metadata.wix] # Custom location to keep the root of the project cleaner diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index 8c243015..357b9d85 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -59,7 +59,21 @@ for your architecture (most likely X64). ## Linux -There are no official packages for Linux yet and if you build from source you hopefully know what you are doing. +For **Ubuntu 22.04 or newer** (older versions not supported) go to [the latest release](https://github.com/nazar-pc/space-acres/releases/latest) and download attached +file with `.deb` extension for your architecture (most likely `amd64`). + +Then open terminal and run following commands to switch to downloads directory and install an app: +```bash +cd Downloads +sudo apt install ./space-acres*.deb +``` + +Replace `Downloads` with correct name of downloads directory if you have non-English Ubuntu installation or if you +downloaded file into a custom location. In case you have multiple versions of Space Acres downloaded, you might want to +replace `space-acres*.deb` with a full name of the file you've downloaded. + +There are no official packages for other Linux distributions yet and if you build from source you hopefully know what +you are doing. Consider [contributing to Linux packaging](https://github.com/nazar-pc/space-acres/issues/6) though! ## macOS diff --git a/res/linux/space-acres-autostart.desktop b/res/linux/space-acres-autostart.desktop new file mode 100644 index 00000000..045fd522 --- /dev/null +++ b/res/linux/space-acres-autostart.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Type=Application +Name=Space Acres +Comment=Space Acres is an opinionated unofficial GUI application for farming on Subspace Network +Icon=/usr/share/icons/hicolor/apps/space-acres.png +Exec=space-acres --startup diff --git a/res/linux/space-acres.desktop b/res/linux/space-acres.desktop index 46ca8ae7..92e0d90b 100644 --- a/res/linux/space-acres.desktop +++ b/res/linux/space-acres.desktop @@ -5,7 +5,7 @@ Categories=Network GenericName=Subspace Network Farming Software Comment=Space Acres is an opinionated unofficial GUI application for farming on Subspace Network Keywords=subspace;farmer;farming -Icon=space-acres +Icon=/usr/share/icons/hicolor/apps/space-acres.png Exec=space-acres Terminal=false StartupNotify=false