mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
5bf61382a4
- The release workflow never runs automatically. It must be manually kicked off. - The release workflow has an input. When running it from the GH actions UI, you will see a "Publish build on PyPi" prompt. If this value is "true", the workflow will upload the build to PyPi, releasing it. If this is anything else (e.g. "false", the default), the workflow will build but not upload to PyPi. - The `dist/` folder (where the python package is built) is uploaded as a workflow artifact as a zip file. This can be downloaded and inspected. This allows "dry" runs of the workflow. - The workflow job and some steps have been renamed to clarify what they do
68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
name: PyPI Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
publish_package:
|
|
description: 'Publish build on PyPi? [true/false]'
|
|
required: true
|
|
default: 'false'
|
|
|
|
jobs:
|
|
build-and-release:
|
|
if: github.repository == 'invoke-ai/InvokeAI'
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
TWINE_NON_INTERACTIVE: 1
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node 18
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v2
|
|
with:
|
|
version: '8.12.1'
|
|
|
|
- name: Install frontend dependencies
|
|
run: pnpm install --prefer-frozen-lockfile
|
|
working-directory: invokeai/frontend/web
|
|
|
|
- name: Build frontend
|
|
run: pnpm run build
|
|
working-directory: invokeai/frontend/web
|
|
|
|
- name: Install python dependencies
|
|
run: pip install --upgrade build twine
|
|
|
|
- name: Build python package
|
|
run: python3 -m build
|
|
|
|
- name: Upload build as workflow artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
|
|
- name: Check distribution
|
|
run: twine check dist/*
|
|
|
|
- name: Check PyPI versions
|
|
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')
|
|
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
|
|
|
|
- name: Publish build on PyPi
|
|
if: env.PACKAGE_EXISTS == 'False' && env.TWINE_PASSWORD != '' && github.event.inputs.publish_package == 'true'
|
|
run: twine upload dist/*
|