-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (40 loc) · 1.15 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
41
42
43
44
45
46
47
48
name: Publish to PyPI
on:
workflow_dispatch:
inputs:
repository:
description: "Target repository (pypi or test)"
required: true
default: "pypi"
jobs:
publish:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout Code
uses: actions/checkout@v3
# Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
# Install build and twine
- name: Install Build Tools
run: |
python -m pip install --upgrade pip
pip install build twine
# Build the package
- name: Build the Package
run: python -m build
- name: Publish to Test PyPI
if: github.event.inputs.repository == 'test'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }}
run: twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- name: Publish to Regular PyPI
if: github.event.inputs.repository == 'pypi'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*