-
Notifications
You must be signed in to change notification settings - Fork 72
64 lines (52 loc) · 1.9 KB
/
publish-pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Publish Package - Python / PyPI
on:
push:
branches: [ main ]
jobs:
ci-build-python:
uses: hack-different/apple-knowledge/.github/workflows/build-python.yml@main
publish-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
environment: pypi-push
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: '3.12'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Download Python Package Artifacts
uses: actions/download-artifact@v3
with:
name: package-python
path: ./_packages/python/dist/
- name: Publish package
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
packages_dir: ./_packages/python/dist/
print_hash: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}