2022-08-14 00:53:37 +02:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
2022-08-15 05:09:54 +02:00
|
|
|
workflow_dispatch:
|
2022-08-16 19:26:06 +02:00
|
|
|
inputs:
|
|
|
|
version:
|
|
|
|
description: 'Version Number'
|
|
|
|
required: true
|
|
|
|
type: string
|
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-15 05:39:45 +02:00
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
extension: deb
|
|
|
|
- os: macos-latest
|
|
|
|
extension: dmg
|
|
|
|
- os: windows-latest
|
|
|
|
extension: exe
|
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-18 19:50:25 +02:00
|
|
|
sudo apt install libegl1 libxcb-xinerama0 python3-tk -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: |
|
2022-08-17 18:53:44 +02:00
|
|
|
# Setup Environment for Reproducible Builds
|
|
|
|
export PYTHONHASHSEED=42
|
2022-08-17 22:17:27 +02:00
|
|
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
|
2022-08-17 18:53:44 +02:00
|
|
|
|
2022-08-17 22:04:26 +02:00
|
|
|
pyinstaller --noconfirm Khoj.spec
|
2022-08-15 04:30:32 +02:00
|
|
|
if [ "$RUNNER_OS" == "Windows" ]; then
|
|
|
|
mv dist/Khoj.exe dist/khoj_"$GITHUB_REF_NAME"_amd64.exe
|
|
|
|
fi
|
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 \
|
2022-08-15 04:30:32 +02:00
|
|
|
"dist/khoj_"$GITHUB_REF_NAME"_amd64.dmg" \
|
2022-08-14 00:53:37 +02:00
|
|
|
"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
|
2022-08-16 19:26:06 +02:00
|
|
|
env:
|
|
|
|
DEBIAN_PACKAGE_VERSION: ${{ inputs.version }}
|
2022-08-14 04:07:58 +02:00
|
|
|
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-16 19:26:06 +02:00
|
|
|
chmod 755 package/opt/Khoj
|
2022-08-14 04:07:58 +02:00
|
|
|
|
|
|
|
# Package the app
|
2022-08-16 19:26:06 +02:00
|
|
|
if [ -z "$DEBIAN_PACKAGE_VERSION" ]; then
|
|
|
|
DEBIAN_PACKAGE_VERSION=$(echo $GITHUB_REF_NAME | sed -E 's/v(.*)/\1/g')
|
|
|
|
fi
|
|
|
|
fpm -C package -s dir -t deb -n Khoj --version $DEBIAN_PACKAGE_VERSION -p dist/khoj_"$GITHUB_REF_NAME"_amd64.deb
|
2022-08-14 04:07:58 +02:00
|
|
|
|
2022-08-14 02:26:40 +02:00
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2022-08-15 05:39:45 +02:00
|
|
|
name: khoj_${{github.ref_name}}_amd64.${{matrix.extension}}
|
|
|
|
path: dist/khoj_${{github.ref_name}}_amd64.${{matrix.extension}}
|
2022-08-15 04:30:32 +02:00
|
|
|
|
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
2022-08-15 16:41:08 +02:00
|
|
|
files: dist/khoj_${{github.ref_name}}_amd64.${{matrix.extension}}
|