2022-08-13 22:53:37 +00:00
|
|
|
name: release
|
|
|
|
|
|
|
|
on:
|
2022-08-15 03:09:54 +00:00
|
|
|
workflow_dispatch:
|
2022-08-16 17:26:06 +00:00
|
|
|
inputs:
|
|
|
|
version:
|
|
|
|
description: 'Version Number'
|
|
|
|
required: true
|
|
|
|
type: string
|
2022-08-13 23:38:20 +00:00
|
|
|
push:
|
2022-08-13 23:40:43 +00:00
|
|
|
tags:
|
|
|
|
- v*
|
2022-08-13 22:53:37 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish:
|
2022-08-14 00:38:29 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-08-15 03:39:45 +00:00
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
extension: deb
|
|
|
|
- os: macos-latest
|
|
|
|
extension: dmg
|
|
|
|
- os: windows-latest
|
|
|
|
extension: exe
|
2022-08-14 00:43:07 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-08-13 22:53:37 +00: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 03:47:58 +00:00
|
|
|
shell: bash
|
2022-08-13 22:53:37 +00:00
|
|
|
run: |
|
2022-08-14 03:24:16 +00:00
|
|
|
if [ "$RUNNER_OS" == "Linux" ]; then
|
2022-08-18 17:50:25 +00:00
|
|
|
sudo apt install libegl1 libxcb-xinerama0 python3-tk -y
|
2022-08-14 03:24:16 +00:00
|
|
|
fi
|
2022-08-13 22:53:37 +00:00
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install pyinstaller
|
|
|
|
|
2022-08-14 01:00:44 +00:00
|
|
|
- name: Install Khoj App
|
2022-08-13 22:53:37 +00:00
|
|
|
run: |
|
|
|
|
pip install --upgrade .
|
|
|
|
|
2022-08-14 01:00:44 +00:00
|
|
|
- name: Package Khoj App
|
|
|
|
shell: bash
|
2022-08-13 22:53:37 +00:00
|
|
|
run: |
|
2022-08-17 16:53:44 +00:00
|
|
|
# Setup Environment for Reproducible Builds
|
|
|
|
export PYTHONHASHSEED=42
|
2022-08-17 20:17:27 +00:00
|
|
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
|
2022-08-17 16:53:44 +00:00
|
|
|
|
2022-08-17 20:04:26 +00:00
|
|
|
pyinstaller --noconfirm Khoj.spec
|
2022-08-15 02:30:32 +00:00
|
|
|
if [ "$RUNNER_OS" == "Windows" ]; then
|
|
|
|
mv dist/Khoj.exe dist/khoj_"$GITHUB_REF_NAME"_amd64.exe
|
|
|
|
fi
|
2022-08-14 01:00:44 +00:00
|
|
|
|
|
|
|
- name: Create Mac App DMG
|
|
|
|
if: matrix.os == 'macos-latest'
|
|
|
|
run: |
|
|
|
|
# Install Mac DMG Creator
|
2022-08-14 00:46:41 +00:00
|
|
|
brew install create-dmg
|
2022-08-13 22:53:37 +00: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 02:30:32 +00:00
|
|
|
"dist/khoj_"$GITHUB_REF_NAME"_amd64.dmg" \
|
2022-08-13 22:53:37 +00:00
|
|
|
"dist/dmg/"
|
2022-08-14 01:00:44 +00:00
|
|
|
|
2022-08-14 03:08:18 +00:00
|
|
|
- uses: ruby/setup-ruby@v1
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
with:
|
|
|
|
ruby-version: '3.0'
|
2022-08-14 02:07:58 +00:00
|
|
|
- name: Create Debian Package
|
|
|
|
if: matrix.os == 'ubuntu-latest'
|
|
|
|
shell: bash
|
2022-08-16 17:26:06 +00:00
|
|
|
env:
|
|
|
|
DEBIAN_PACKAGE_VERSION: ${{ inputs.version }}
|
2022-08-14 02:07:58 +00:00
|
|
|
run: |
|
|
|
|
# Install Debian Packager
|
2022-08-14 03:08:18 +00:00
|
|
|
gem install fpm
|
2022-08-14 02:07:58 +00: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 17:26:06 +00:00
|
|
|
chmod 755 package/opt/Khoj
|
2022-08-14 02:07:58 +00:00
|
|
|
|
|
|
|
# Package the app
|
2022-08-16 17:26:06 +00: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 02:07:58 +00:00
|
|
|
|
2022-08-14 00:26:40 +00:00
|
|
|
- uses: actions/upload-artifact@v3
|
|
|
|
with:
|
2022-08-15 03:39:45 +00:00
|
|
|
name: khoj_${{github.ref_name}}_amd64.${{matrix.extension}}
|
|
|
|
path: dist/khoj_${{github.ref_name}}_amd64.${{matrix.extension}}
|
2022-08-15 02:30:32 +00:00
|
|
|
|
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
with:
|
2022-08-15 14:41:08 +00:00
|
|
|
files: dist/khoj_${{github.ref_name}}_amd64.${{matrix.extension}}
|