mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 13:18:18 +00:00
- Why The khoj pypi packages should be installed in `khoj' directory. Previously it was being installed into `src' directory, which is a generic top level directory name that is discouraged from being used - Changes - move src/* to src/khoj/* - update `setup.py' to `find_packages' in `src' instead of project root - rename imports to form `from khoj.*' in complete project - update `constants.web_directory' path to use `khoj' directory - rename root logger to `khoj' in `main.py' - fix image_search tests to use the newly rename `khoj' logger - update config, docs, workflows to reference new path `src/khoj'
95 lines
2.6 KiB
YAML
95 lines
2.6 KiB
YAML
name: publish
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
branches:
|
|
- 'master'
|
|
paths:
|
|
- src/khoj/**
|
|
- setup.py
|
|
- .github/workflows/publish.yml
|
|
pull_request:
|
|
branches:
|
|
- 'master'
|
|
paths:
|
|
- src/khoj/**
|
|
- setup.py
|
|
- .github/workflows/publish.yml
|
|
|
|
jobs:
|
|
publish:
|
|
name: Publish App to PyPI
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up Python 3.10
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.10'
|
|
|
|
- name: Install Dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install build twine
|
|
|
|
- name: Install Application
|
|
run: |
|
|
pip install --upgrade .
|
|
|
|
- name: Publish Release to PyPI
|
|
if: startsWith(github.ref, 'refs/tags')
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
|
|
run: |
|
|
# Setup Environment for Reproducible Builds
|
|
export PYTHONHASHSEED=42
|
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
|
|
|
|
# Build and Upload PyPi Package
|
|
rm -rf dist
|
|
python -m build
|
|
twine check dist/*
|
|
twine upload --verbose dist/*
|
|
|
|
- name: Publish Master to PyPI
|
|
if: github.ref == 'refs/heads/master'
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_KEY }}
|
|
run: |
|
|
# Set Pre-Release Version
|
|
sed -E -i "s/version=(.*)',/version=\1a$(date +%s)',/g" setup.py
|
|
|
|
# Setup Environment for Reproducible Builds
|
|
export PYTHONHASHSEED=42
|
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
|
|
|
|
# Build and Upload PyPi Package
|
|
rm -rf dist
|
|
python -m build
|
|
twine check dist/*
|
|
twine upload --verbose dist/*
|
|
|
|
- name: Publish Repo PR to Test PyPI
|
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_KEY }}
|
|
PULL_REQUEST_NUMBER: ${{ github.event.number }}
|
|
run: |
|
|
# Set Development Release Version
|
|
sed -E -i "s/version=(.*)',/version=\1.dev$PULL_REQUEST_NUMBER$(date +%s)',/g" setup.py
|
|
|
|
# Setup Environment for Reproducible Builds
|
|
export PYTHONHASHSEED=42
|
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
|
|
|
|
# Build and Upload PyPi Package
|
|
rm -rf dist
|
|
python -m build
|
|
twine check dist/*
|
|
twine upload -r testpypi --verbose dist/* |