Skip to content

Commit

Permalink
Generate AppImage for Linux Github builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Nov 16, 2020
1 parent 1ba5052 commit f35032b
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 7 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
Linux:
timeout-minutes: 20
runs-on: ubuntu-18.04
runs-on: ubuntu-16.04

env:
GRABBER_VERSION: nightly
Expand All @@ -18,7 +18,7 @@ jobs:
submodules: recursive

- name: Install packages
run: sudo apt-get install libpulse-dev
run: sudo apt-get install libpulse-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libgstreamer-plugins-base1.0-0

- name: Cache Qt
id: cache-qt
Expand All @@ -33,12 +33,23 @@ jobs:
cached: ${{ steps.cache-qt.outputs.cache-hit }}
version: 5.15.1

- name: Vendor cache
uses: actions/cache@v1
id: vendor-cache
with:
path: vendor
key: ${{ runner.os }}-bin-${{ hashFiles('.github/workflows/linux.yml') }}

- name: Create vendor dir
if: steps.vendor-cache.outputs.cache-hit != 'true'
run: mkdir vendor

- name: Create build dir
run: mkdir build

- name: Configure
working-directory: build
run: cmake ../src -DCMAKE_BUILD_TYPE=Release -DNIGHTLY=$GRABBER_IS_NIGHTLY -DCOMMIT="$GITHUB_SHA" -DVERSION="$GRABBER_VERSION"
run: cmake ../src -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DNIGHTLY=$GRABBER_IS_NIGHTLY -DCOMMIT="$GITHUB_SHA" -DVERSION="$GRABBER_VERSION"

- name: Compile
working-directory: build
Expand All @@ -52,10 +63,15 @@ jobs:
working-directory: src
run: ../build/tests/tests

- name: Generate package
- name: Download linuxdeployqt
if: steps.vendor-cache.outputs.cache-hit != 'true'
working-directory: vendor
run: |
./scripts/package-linux.sh
mv Grabber.tar.gz Grabber_nightly.tar.gz
curl -Lo "linuxdeployqt.AppImage" "https://github.com/probonopd/linuxdeployqt/releases/download/7/linuxdeployqt-7-x86_64.AppImage"
chmod a+x linuxdeployqt.AppImage
- name: Generate package
run: ./scripts/package-appimage.sh

- name: Get date for Nightly body
id: date
Expand All @@ -72,7 +88,7 @@ jobs:
allowUpdates: true
draft: false
prerelease: true
artifacts: Grabber_*.tar.gz
artifacts: Grabber_*.AppImage
body: |
Nightly automated builds from the develop branch.
Automatically uploaded by Github actions, **use at your own risk**!
Expand Down
34 changes: 34 additions & 0 deletions scripts/package-appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Package everything into an AppImage file at the root of the git repository

set -e

# Create the application directory
APP_DIR="release"
mkdir -p $APP_DIR

# Application binary
mkdir -p $APP_DIR/usr/bin
cp "build/gui/Grabber" $APP_DIR/usr/bin

# Desktop file
mkdir -p $APP_DIR/usr/share/applications
cp "src/dist/linux/Grabber.desktop" $APP_DIR/usr/share/applications

# Icon
mkdir -p $APP_DIR/usr/share/icons/hicolor
cp "src/gui/resources/images/icon.png" $APP_DIR/usr/share/icons/hicolor/Grabber.png

# Copy other files in $PREFIX/share/Grabber where they can be found
mkdir -p $APP_DIR/usr/share/Grabber
rsync -ar --exclude="node_modules" --exclude="CMakeLists.txt" --exclude="package*.json" --exclude="*.config.js" --exclude="tsconfig.json" --exclude="tslint.json" --exclude="**/*.ts" --exclude="**/resources" --exclude="Sankaku" --exclude="Tumblr" src/sites $APP_DIR/usr/share/Grabber
cp -r src/dist/common/* $APP_DIR/usr/share/Grabber
touch "$APP_DIR/usr/share/Grabber/settings.ini"

# See https://github.com/probonopd/linuxdeployqt
export VERSION=$GRABBER_VERSION
./vendor/linuxdeployqt.AppImage "$APP_DIR/usr/share/applications/Grabber.desktop" -appimage
mv "Grabber-$VERSION-x86_64.AppImage" "Grabber_$VERSION-x86_64.AppImage"

# Cleanup
rm -rf $APP_DIR
2 changes: 2 additions & 0 deletions scripts/package-mac.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
# Package everything into a "Grabber.dmg" file at the root of the git repository

set -e

# Create the application directory
APP_ROOT="Grabber.app"
APP_DIR="$APP_ROOT/Contents/MacOS"
Expand Down
2 changes: 2 additions & 0 deletions scripts/uncrustify.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env sh

set -e

# "src/gui/src/" "src/tests/src/"
find "src/lib/src/" "src/cli/src/" "src/e2e/src/" -name '*.cpp' -o -name '*.h' \
| grep -v "vendor" \
Expand Down
1 change: 1 addition & 0 deletions src/dist/linux/Grabber.desktop
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[Desktop Entry]
Name=Grabber
Comment=Very customizable imageboard/booru downloader with powerful filenaming features
Exec=Grabber
Icon=Grabber
Type=Application
Expand Down

0 comments on commit f35032b

Please sign in to comment.