Added appimage

This commit is contained in:
Arc 2024-09-27 13:24:02 +01:00
parent f66a46ecce
commit 707ccd376f
2 changed files with 125 additions and 0 deletions

View File

@ -52,3 +52,58 @@ jobs:
uses: JRubics/poetry-publish@v1.15
with:
pypi_token: ${{ secrets.PYPI_API_KEY }}
appimage:
needs: [ release ]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: sudo apt update -y && sudo apt install -y software-properties-common curl git fuse
- name: Add deadsnakes PPA and install Python 3.9
run: |
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt install -y python3.9 python3.9-distutils
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3.9 -
- name: Add Poetry to PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Build AppImage
run: bash build_appimage.sh
- name: Upload AppImage
uses: actions/upload-artifact@v2
with:
name: LNbits.AppImage
path: LNbits*.AppImage
release-appimage:
needs: [ appimage ]
runs-on: ubuntu-latest
steps:
- name: Download AppImage
uses: actions/download-artifact@v2
with:
name: LNbits.AppImage
path: .
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./LNbits*.AppImage
asset_name: LNbits.AppImage
asset_content_type: application/octet-stream

70
build_appimage.sh Normal file
View File

@ -0,0 +1,70 @@
#!/bin/bash
set -e
# Define variables
APP_NAME="LNbits"
APP_VERSION="1.0.0"
APP_DIR="${APP_NAME}.AppDir"
APPIMAGE_TOOL="appimagetool-x86_64.AppImage"
# Install dependencies
sudo apt update -y
sudo apt install -y software-properties-common curl git fuse
# Add the deadsnakes PPA repository and install Python 3.9
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt install -y python3.9 python3.9-distutils
# Install Poetry
curl -sSL https://install.python-poetry.org | python3.9 -
# Add Poetry to PATH
export PATH="/home/$USER/.local/bin:$PATH"
# Clone the LNbits repository
if [ ! -d lnbits ]; then
git clone https://github.com/lnbits/lnbits.git
fi
cd lnbits
# Check out the main branch and install dependencies
git checkout main
poetry env use python3.9
poetry install --only main
# Create the AppDir structure
mkdir -p ${APP_DIR}/usr/bin
mkdir -p ${APP_DIR}/usr/share/applications
mkdir -p ${APP_DIR}/usr/share/icons/hicolor/256x256/apps
# Copy the LNbits files to the AppDir
cp -r * ${APP_DIR}/usr/bin/
# Create a desktop entry
cat > ${APP_DIR}/usr/share/applications/${APP_NAME}.desktop <<EOF
[Desktop Entry]
Name=${APP_NAME}
Exec=${APP_NAME}
Icon=${APP_NAME}
Type=Application
Categories=Utility;
EOF
# Create an icon (replace with your actual icon)
cp path/to/icon.png ${APP_DIR}/usr/share/icons/hicolor/256x256/apps/${APP_NAME}.png
# Download the AppImage tool
if [ ! -f ${APPIMAGE_TOOL} ]; then
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/${APPIMAGE_TOOL}
chmod +x ${APPIMAGE_TOOL}
fi
# Build the AppImage
./${APPIMAGE_TOOL} ${APP_DIR}
# Move the AppImage to the output directory
mv ${APP_NAME}*.AppImage ../
echo "AppImage created successfully!"