2022-08-14 00:53:37 +02:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
2022-08-14 01:38:20 +02:00
|
|
|
push:
|
2022-08-14 01:40:43 +02:00
|
|
|
tags:
|
|
|
|
- v*
|
2022-08-14 00:53:37 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish:
|
2022-08-14 02:38:29 +02:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-08-14 05:41:54 +02:00
|
|
|
os: [macos-latest, ubuntu-latest, windows-latest]
|
2022-08-14 02:43:07 +02:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-08-14 00:53:37 +02:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Python 3.9
|
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
2022-08-14 05:47:58 +02:00
|
|
|
shell: bash
|
2022-08-14 00:53:37 +02:00
|
|
|
run: |
|
2022-08-14 05:24:16 +02:00
|
|
|
if [ "$RUNNER_OS" == "Linux" ]; then
|
2022-08-14 05:30:00 +02:00
|
|
|
sudo apt install libegl1 libxcb-xinerama0 -y
|
2022-08-14 05:24:16 +02:00
|
|
|
fi
|
2022-08-14 00:53:37 +02:00
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install pyinstaller
|
|
|
|
|
2022-08-14 03:00:44 +02:00
|
|
|
- name: Install Khoj App
|
2022-08-14 00:53:37 +02:00
|
|
|
run: |
|
|
|
|
pip install --upgrade .
|
|
|
|
|
2022-08-14 03:00:44 +02:00
|
|
|
- name: Package Khoj App
|
|
|
|
shell: bash
|
2022-08-14 00:53:37 +02:00
|
|
|
run: |
|
|
|
|
pyinstaller Khoj.spec
|
2022-08-14 03:00:44 +02:00
|
|
|
|
|
|
|
- name: Create Mac App DMG
|
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
run: |
|
|
|
|
# Install Mac DMG Creator
|
2022-08-14 02:46:41 +02:00
|
|
|
brew install create-dmg
|
2022-08-14 00:53:37 +02:00
|
|
|
# Copy app to separate dmg folder
|
|
|
|
mkdir -p dist/dmg && cp -r dist/Khoj.app dist/dmg
|
|
|
|
# Create disk image with the app
|
|
|
|
create-dmg \
|
|
|
|
--volname "Khoj" \
|
|
|
|
--volicon "src/interface/web/assets/icons/favicon.icns" \
|
|
|
|
--window-pos 200 120 \
|
|
|
|
--window-size 600 300 \
|
|
|
|
--icon-size 100 \
|
|
|
|
--icon "Khoj.app" 175 120 \
|
|
|
|
--hide-extension "Khoj.app" \
|
|
|
|
--app-drop-link 425 120 \
|
|
|
|
"dist/Khoj.dmg" \
|
|
|
|
"dist/dmg/"
|
2022-08-14 03:00:44 +02:00
|
|
|
|
2022-08-14 05:08:18 +02:00
|
|
|
- uses: ruby/setup-ruby@v1
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
with:
|
|
|
|
ruby-version: '3.0'
|
2022-08-14 04:07:58 +02:00
|
|
|
- name: Create Debian Package
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
# Install Debian Packager
|
2022-08-14 05:08:18 +02:00
|
|
|
gem install fpm
|
2022-08-14 04:07:58 +02:00
|
|
|
|
|
|
|
# Copy app files into expected output directory structure
|
|
|
|
mkdir -p package/opt package/usr/share/applications package/usr/share/icons/hicolor/128x128/apps
|
|
|
|
cp -r dist/Khoj package/opt/Khoj
|
|
|
|
cp src/interface/web/assets/icons/favicon-128x128.png package/usr/share/icons/hicolor/128x128/apps/Khoj.png
|
|
|
|
cp Khoj.desktop package/usr/share/applications
|
|
|
|
|
|
|
|
# Fix permissions to be usable by non-root users
|
|
|
|
find package/usr/share -type f -exec chmod 644 -- {} +
|
2022-08-14 04:46:52 +02:00
|
|
|
chmod 644 package/opt/Khoj
|
2022-08-14 04:07:58 +02:00
|
|
|
|
|
|
|
# Package the app
|
2022-08-14 05:24:16 +02:00
|
|
|
fpm -C package -s dir -t deb -n "Khoj" --version "$GITHUB_REF_NAME" -p dist/Khoj.deb
|
2022-08-14 04:07:58 +02:00
|
|
|
|
2022-08-14 02:26:40 +02:00
|
|
|
- uses: actions/upload-artifact@v3
|
2022-08-14 02:38:29 +02:00
|
|
|
if : matrix.os == 'macos-latest'
|
2022-08-14 02:26:40 +02:00
|
|
|
with:
|
|
|
|
name: khoj.dmg
|
2022-08-14 02:38:29 +02:00
|
|
|
path: dist/Khoj.dmg
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
if : matrix.os == 'windows-latest'
|
|
|
|
with:
|
|
|
|
name: khoj.exe
|
|
|
|
path: dist/Khoj.exe
|
|
|
|
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
if : matrix.os == 'ubuntu-latest'
|
|
|
|
with:
|
2022-08-14 04:07:58 +02:00
|
|
|
name: khoj.deb
|
|
|
|
path: dist/Khoj.deb
|