2023-02-04 21:58:21 +00:00
|
|
|
name: PyPI Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
paths:
|
2023-03-03 06:44:55 +00:00
|
|
|
- 'invokeai/version/invokeai_version.py'
|
2023-02-04 21:58:21 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
release:
|
2023-02-04 22:58:07 +00:00
|
|
|
if: github.repository == 'invoke-ai/InvokeAI'
|
2023-02-04 21:58:21 +00:00
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
env:
|
|
|
|
TWINE_USERNAME: __token__
|
|
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
|
|
TWINE_NON_INTERACTIVE: 1
|
|
|
|
steps:
|
|
|
|
- name: checkout sources
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: install deps
|
|
|
|
run: pip install --upgrade build twine
|
|
|
|
|
|
|
|
- name: build package
|
|
|
|
run: python3 -m build
|
|
|
|
|
|
|
|
- name: check distribution
|
|
|
|
run: twine check dist/*
|
|
|
|
|
|
|
|
- name: check PyPI versions
|
2023-10-13 16:49:24 +00:00
|
|
|
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')
|
2023-02-04 21:58:21 +00:00
|
|
|
run: |
|
|
|
|
pip install --upgrade requests
|
|
|
|
python -c "\
|
|
|
|
import scripts.pypi_helper; \
|
|
|
|
EXISTS=scripts.pypi_helper.local_on_pypi(); \
|
|
|
|
print(f'PACKAGE_EXISTS={EXISTS}')" >> $GITHUB_ENV
|
|
|
|
|
2023-02-04 22:05:29 +00:00
|
|
|
- name: upload package
|
2023-02-04 22:58:07 +00:00
|
|
|
if: env.PACKAGE_EXISTS == 'False' && env.TWINE_PASSWORD != ''
|
2023-02-04 22:05:29 +00:00
|
|
|
run: twine upload dist/*
|