-
Notifications
You must be signed in to change notification settings - Fork 13
40 lines (36 loc) · 1.07 KB
/
publish.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
# This workflow publishes a distribution to PyPI when a commit is pushed to the main branch.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Publish to PyPI
on:
workflow_dispatch:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Build
uses: ./.github/workflows/build.yml
publish:
name: Publish distribution to PyPI
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
environment: pypi_prod
needs: [build]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install flit
run: |
pip install flit
- name: Publish the distibution to PyPI
run: flit publish
env:
FLIT_INDEX_URL: https://upload.pypi.org/legacy/
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets. PYPI_API_TOKEN }}