Skip to content

Build and publish appimage #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/build-appimage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#on: workflow_dispatch
on: push

name: Build AppImage package

jobs:
build-appimage:
runs-on: ubuntu-latest
name: Build AppImage package

steps:
- name: Clone repo
uses: actions/checkout@v4

- name: Install necessary packages
run: |
sudo apt-get update
sudo apt-get -y install desktop-file-utils

- name: Build AppImage
env:
TARGET_ARCH: amd64
run: |
bash ./appimage/build-appimage.sh

- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: Quarto-amd64.AppImage
path: Quarto-amd64.AppImage

test-appimage:
runs-on: ubuntu-latest
name: Test Appimage Package
needs: build-appimage

steps:
- uses: actions/download-artifact@v4
with:
name: Quarto-amd64.AppImage
path: .

- run: |
mv Quarto-amd64.AppImage quarto
chmod a+x quarto

- run: |
ls -lR
./quarto check
./quarto --paths
./quarto --version
12 changes: 12 additions & 0 deletions appimage/AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
SELF=$(readlink -f "$0")
HERE=${SELF%/*}
export PATH="${HERE}/usr/bin/:${HERE}/usr/sbin/:${HERE}/usr/games/:${HERE}/bin/:${HERE}/sbin/${PATH:+:$PATH}"
export LD_LIBRARY_PATH="${HERE}/usr/lib/:${HERE}/usr/lib/i386-linux-gnu/:${HERE}/usr/lib/x86_64-linux-gnu/:${HERE}/usr/lib32/:${HERE}/usr/lib64/:${HERE}/lib/:${HERE}/lib/i386-linux-gnu/:${HERE}/lib/x86_64-linux-gnu/:${HERE}/lib32/:${HERE}/lib64/${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export PYTHONPATH="${HERE}/usr/share/pyshared/${PYTHONPATH:+:$PYTHONPATH}"
export XDG_DATA_DIRS="${HERE}/usr/share/${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
export PERLLIB="${HERE}/usr/share/perl5/:${HERE}/usr/lib/perl5/${PERLLIB:+:$PERLLIB}"
export GSETTINGS_SCHEMA_DIR="${HERE}/usr/share/glib-2.0/schemas/${GSETTINGS_SCHEMA_DIR:+:$GSETTINGS_SCHEMA_DIR}"
export QT_PLUGIN_PATH="${HERE}/usr/lib/qt4/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt4/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt4/plugins/:${HERE}/usr/lib32/qt4/plugins/:${HERE}/usr/lib64/qt4/plugins/:${HERE}/usr/lib/qt5/plugins/:${HERE}/usr/lib/i386-linux-gnu/qt5/plugins/:${HERE}/usr/lib/x86_64-linux-gnu/qt5/plugins/:${HERE}/usr/lib32/qt5/plugins/:${HERE}/usr/lib64/qt5/plugins/${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
EXEC=$(grep -e '^Exec=.*' "${HERE}"/*.desktop | head -n 1 | cut -d "=" -f 2 | cut -d " " -f 1)
exec "${EXEC}" "$@"
74 changes: 74 additions & 0 deletions appimage/build-appimage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#! /usr/bin/env bash

# -e - Exit immediately if any command fails.
# -u - Exit if an unset variable is invoked.
# -o pipefail - Exit if a command in a piped series of commands fails.
set -euo pipefail

DIR_OUTPUT="./AppDir"
URL_RELEASE="https://quarto.org/docs/download/_download.json"
PLATFORM_TARGET=$TARGET_ARCH

get_current_release_build() {
echo "Trying to get latest release build."

# Download release info document.
wget --output-document "release-info.json" $URL_RELEASE

# Get latest download url. Matching here a fixed host as security
# precaution.
myurl=$(grep -oP "download_url\": \"\Khttps://github.com/quarto-dev/quarto-cli/.*-linux-${PLATFORM_TARGET}.*.tar.gz(?=\")" release-info.json)

# Download release tarball.
wget --output-document "quarto-release.tar.gz" $myurl
}

extract_release_build() {
echo "Extracting latest release build."

mkdir -p "quarto-release"
tar --strip-components=1 -xvf "quarto-release.tar.gz" --directory "quarto-release"
}

get_appimage_builder() {
echo "Getting appimage builder."

if [ $PLATFORM_TARGET = "amd64" ]
then
wget --output-document "appimagetool.AppImage" "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage"
elif [ $PLATFORM_TARGET = "arm64" ]
then
wget --output-document "appimagetool.AppImage" "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage"
else
echo "Unsupported target platform."
exit 1
fi

chmod a+x ./appimagetool.AppImage
}

prepare_appimage() {
echo "Preparing appimage directory."

mkdir -p $DIR_OUTPUT

# Copy files from release tarball.
cp -a -r ./quarto-release/ $DIR_OUTPUT/usr/

# Copy other necessary files.
cp ./appimage/AppRun $DIR_OUTPUT/
cp ./appimage/quarto.desktop $DIR_OUTPUT/
cp ./appimage/quarto.svg $DIR_OUTPUT/
}

build_appimage() {
echo "Building quarto appimage."

./appimagetool.AppImage $DIR_OUTPUT Quarto-${PLATFORM_TARGET}.AppImage
}

get_current_release_build
extract_release_build
get_appimage_builder
prepare_appimage
build_appimage
7 changes: 7 additions & 0 deletions appimage/quarto.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Type=Application
Name=Quarto
Icon=quarto
Exec=quarto render %u
Terminal=true
Categories=Development;Building;Science;
56 changes: 56 additions & 0 deletions appimage/quarto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.