Skip to content

Commit

Permalink
Merge pull request #70 from nazar-pc/improve-linux-packaging
Browse files Browse the repository at this point in the history
Improve Linux packaging
  • Loading branch information
nazar-pc authored Dec 23, 2023
2 parents da12e04 + c95d612 commit 55be15a
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 8 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ jobs:
- name: Checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # @v3.1.0

- name: Install GTK4 (Ubuntu)
run: sudo apt-get install --no-install-recommends -y libgtk-4-dev
- name: Install GTK4 and libfuse2 (Linux)
# libfuse2 is needed for AppImage to run
run: sudo apt-get install --no-install-recommends -y libgtk-4-dev libfuse2
if: runner.os == 'Linux'

- name: Configure GTK4 cache (Windows)
Expand Down Expand Up @@ -200,14 +201,32 @@ jobs:

- name: Package (Linux)
run: |
# Build Debian package
cargo deb --target ${{ matrix.build.target }} --profile production --no-build --no-strip
# And build AppImage as well
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
wget https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/3b67a1d1c1b0c8268f57f2bce40fe2d33d409cea/linuxdeploy-plugin-gtk.sh
chmod +x linuxdeploy*.AppImage linuxdeploy-plugin-gtk.sh
NO_STRIP=1 ./linuxdeploy-x86_64.AppImage \
--appdir AppDir \
--plugin gtk \
--executable target/${{ matrix.build.target }}/production/space-acres \
--desktop-file res/linux/space-acres.desktop \
--icon-file res/linux/space-acres.png \
--output appimage
# Rename AppImage to be consistent with other files
version=$(grep -Po 'version = "\K.*?(?=")' -m 1 Cargo.toml)
mv Space_Acres-x86_64.AppImage space-acres-$version-x86_64.AppImage
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: |
space-acres-*.AppImage
target/${{ matrix.build.target }}/debian/*.deb
if-no-files-found: error
if: runner.os == 'Linux'
Expand All @@ -217,5 +236,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["target/${{ matrix.build.target }}/debian/*.deb"]'
asset_paths: '["space-acres-*.AppImage", "target/${{ matrix.build.target }}/debian/*.deb"]'
if: runner.os == 'Linux' && github.event_name == 'push' && github.ref_type == 'tag'
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ 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"],
["res/linux/space-acres.png", "/usr/share/pixmaps/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
Expand Down
26 changes: 24 additions & 2 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ for your architecture (most likely X64).

## Linux

Currently, there are two ways to get Space Acres on Linux:
* by installing `.deb` package on Ubuntu
* by running `.AppImage` bundle directly on any modern Linux distribution (including Ubuntu if you want to)

### Ubuntu

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`).

Expand All @@ -72,9 +78,25 @@ Replace `Downloads` with correct name of downloads directory if you have non-Eng
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
### Other Linux

For other distributions AppImage is available too, go to [the latest release](https://github.com/nazar-pc/space-acres/releases/latest) and download attached
file with `.AppImage` extension for your architecture (most likely `x86_64`).

Then open terminal and run following commands to switch to downloads directory and make it executable:
```bash
cd Downloads
chmod +x space-acres-*.AppImage
```

After this either use `./space-acres-*.AppImage` in the terminal or double-click on the file in the file manager to open
the app. You may need to install FUSE library if you don't have it installed yet. In case you have multiple versions of
Space Acres downloaded, you might want to replace `space-acres-*.AppImage` with a full name of the file you've
downloaded.

There are no other Linux packages at the moment 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!
Consider contributing to Linux packaging though!

## macOS

Expand Down
2 changes: 1 addition & 1 deletion res/linux/space-acres-autostart.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
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
Icon=space-acres
Exec=space-acres --startup
2 changes: 1 addition & 1 deletion res/linux/space-acres.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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=/usr/share/icons/hicolor/apps/space-acres.png
Icon=space-acres
Exec=space-acres
Terminal=false
StartupNotify=false
Expand Down

0 comments on commit 55be15a

Please sign in to comment.