-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (45 loc) · 1.55 KB
/
publish_to_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
# .github/workflows/workflow.yml
# This workflow will upload a Python Package using Twine when a release is created.
# For more information see: https://docs.github.com/en/actions/guides/building-and-testing-python
name: Upload Python Package to PyPi
on:
push:
branches:
- master
release:
types: [created]
workflow_dispatch:
# Define top-level permissions
permissions:
contents: write # Allows write access to repository contents (needed for checkout)
id-token: write
packages: write # Allows uploading packages to GitHub Packages or external registries
actions: write # Allows reading workflow run information
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12' # Specify your Python version
- name: Add repository sub-modules
run: |
git submodule init
git submodule update
- name: Install build and Twine
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build the package
run: |
python -m build --sdist --wheel
# The '--sdist --wheel' flags are optional as 'python -m build' builds both by default
- name: Publish to TestPyPI
env:
TWINE_USERNAME: ${{ secrets.TEST_PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PASSWORD }}
run: |
twine upload --verbose --repository-url https://test.pypi.org/legacy/ dist/*