2023-02-15 01:47:42 +00:00
|
|
|
name: pypi
|
2022-08-03 18:57:27 +00:00
|
|
|
|
|
|
|
on:
|
2022-08-15 03:47:36 +00:00
|
|
|
push:
|
|
|
|
tags:
|
2023-01-04 23:46:48 +00:00
|
|
|
- "*"
|
2022-08-03 18:57:27 +00:00
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
paths:
|
2023-02-14 20:50:51 +00:00
|
|
|
- src/khoj/**
|
2024-06-22 14:42:41 +00:00
|
|
|
- src/interface/web/**
|
2023-02-16 09:12:04 +00:00
|
|
|
- pyproject.toml
|
2023-02-15 01:47:42 +00:00
|
|
|
- .github/workflows/pypi.yml
|
2023-02-14 19:47:25 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
paths:
|
2023-02-14 20:50:51 +00:00
|
|
|
- src/khoj/**
|
2024-06-22 14:42:41 +00:00
|
|
|
- src/interface/web/**
|
2023-02-16 09:12:04 +00:00
|
|
|
- pyproject.toml
|
2023-02-15 01:47:42 +00:00
|
|
|
- .github/workflows/pypi.yml
|
2024-08-06 10:25:39 +00:00
|
|
|
workflow_dispatch:
|
2022-08-03 18:57:27 +00:00
|
|
|
|
|
|
|
jobs:
|
2022-08-04 00:49:32 +00:00
|
|
|
publish:
|
2023-02-15 01:47:42 +00:00
|
|
|
name: Publish Python Package to PyPI
|
2024-03-28 18:28:15 +00:00
|
|
|
runs-on: ubuntu-latest
|
2024-03-28 17:28:36 +00:00
|
|
|
permissions:
|
|
|
|
id-token: write
|
2022-08-03 18:57:27 +00:00
|
|
|
steps:
|
2024-07-16 16:15:41 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-15 01:47:42 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-08-03 18:57:27 +00:00
|
|
|
|
2024-03-28 06:49:07 +00:00
|
|
|
- name: Set up Python 3.11
|
2022-08-03 18:57:27 +00:00
|
|
|
uses: actions/setup-python@v4
|
|
|
|
with:
|
2024-03-28 06:49:07 +00:00
|
|
|
python-version: '3.11'
|
2022-08-03 18:57:27 +00:00
|
|
|
|
2024-07-16 16:15:41 +00:00
|
|
|
- name: ⬇️ Install Server
|
2023-02-15 03:44:00 +00:00
|
|
|
run: python -m pip install --upgrade pip && pip install --upgrade .
|
2022-08-03 18:57:27 +00:00
|
|
|
|
2024-07-16 16:15:41 +00:00
|
|
|
- name: ⬇️ Install Web Client
|
2024-06-22 14:42:41 +00:00
|
|
|
run: |
|
|
|
|
yarn install
|
2024-08-05 17:16:54 +00:00
|
|
|
yarn pypiciexport
|
2024-06-22 14:42:41 +00:00
|
|
|
working-directory: src/interface/web
|
|
|
|
|
2024-08-06 04:35:06 +00:00
|
|
|
- name: 📂 Copy Generated Files
|
|
|
|
run: |
|
2024-08-06 08:01:42 +00:00
|
|
|
mkdir -p src/khoj/interface/compiled
|
2024-12-13 00:50:32 +00:00
|
|
|
cp -r /opt/hostedtoolcache/Python/3.11.11/x64/lib/python3.11/site-packages/khoj/interface/compiled/* src/khoj/interface/compiled/
|
2024-08-06 04:35:06 +00:00
|
|
|
|
2023-02-15 01:47:42 +00:00
|
|
|
- name: ⚙️ Build Python Package
|
|
|
|
run: |
|
2022-08-19 18:00:12 +00:00
|
|
|
# Setup Environment for Reproducible Builds
|
|
|
|
export PYTHONHASHSEED=42
|
|
|
|
export SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
|
2023-02-15 03:44:00 +00:00
|
|
|
rm -rf dist
|
2022-08-19 18:00:12 +00:00
|
|
|
|
2024-08-20 18:40:07 +00:00
|
|
|
# Build PyPI Package
|
2023-02-15 03:44:00 +00:00
|
|
|
pipx run build
|
2023-02-14 19:41:33 +00:00
|
|
|
|
2023-03-01 16:56:39 +00:00
|
|
|
- name: 🌡️ Validate Python Package
|
2023-02-15 01:47:42 +00:00
|
|
|
run: |
|
2023-02-14 19:41:33 +00:00
|
|
|
# Validate PyPi Package
|
2023-11-21 19:33:43 +00:00
|
|
|
pipx run check-wheel-contents dist/*.whl --ignore W004
|
2023-02-15 03:44:00 +00:00
|
|
|
pipx run twine check dist/*
|
2023-02-14 19:41:33 +00:00
|
|
|
|
2023-02-15 01:47:42 +00:00
|
|
|
- name: ⏫ Upload Python Package Artifacts
|
2024-07-16 16:15:41 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-02-15 01:47:42 +00:00
|
|
|
with:
|
2024-07-16 16:15:41 +00:00
|
|
|
name: khoj
|
|
|
|
path: dist/khoj-*.whl
|
2023-02-15 01:47:42 +00:00
|
|
|
|
2024-08-20 18:40:07 +00:00
|
|
|
- name: 📦 Publish Python Package to PyPI
|
2023-02-15 01:47:42 +00:00
|
|
|
if: startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master'
|
2024-12-17 21:28:50 +00:00
|
|
|
uses: pypa/gh-action-pypi-publish@release/v1.12
|
2024-08-20 18:40:07 +00:00
|
|
|
with:
|
|
|
|
skip-existing: true
|
2024-12-17 21:28:50 +00:00
|
|
|
print-hash: true
|