Skip to content

Commit fd10ea7

Browse files
Merge pull request micropython#59 from wnienhaus/publish-to-pypi
Publish to pypi
2 parents 3f9956c + aad344b commit fd10ea7

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

.github/workflows/publish.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish Python Package
2+
3+
on:
4+
# trigger when publishing a release
5+
release:
6+
types: [published]
7+
8+
# also allow triggering this workflow manually for testing
9+
workflow_dispatch:
10+
11+
jobs:
12+
publish:
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
with:
20+
# just fetching 1 commit is not enough for setuptools-scm, so we fetch all
21+
fetch-depth: 0
22+
- name: Set up Python
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: '3.x'
26+
- name: Install dependencies
27+
run: |
28+
pip install setuptools setuptools_scm
29+
- name: Build package
30+
run: |
31+
python setup.py sdist
32+
rm dist/*.orig # clean sdist_upip noise
33+
- name: Publish to Test PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
37+
repository_url: https://test.pypi.org/legacy/
38+
- name: Publish to PyPI
39+
uses: pypa/gh-action-pypi-publish@release/v1
40+
if: github.event.release.tag_name # only when releasing a new version
41+
with:
42+
password: ${{ secrets.PYPI_API_TOKEN }}

setup.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import sdist_upip
33
from setuptools import setup
44

5-
VERSION = "1.0.0"
6-
75

86
def long_desc_from_readme():
97
with open('README.rst', 'r') as fd:
@@ -20,7 +18,9 @@ def long_desc_from_readme():
2018

2119
setup(
2220
name="micropython-py-esp32-ulp",
23-
version=VERSION,
21+
use_scm_version={
22+
'local_scheme': 'no-local-version',
23+
},
2424
description="Assembler toolchain for the ESP32 ULP co-processor, written in MicroPython",
2525
long_description=long_desc_from_readme(),
2626
long_description_content_type='text/x-rst',
@@ -34,6 +34,7 @@ def long_desc_from_readme():
3434
'License :: OSI Approved :: MIT License',
3535
'Programming Language :: Python :: Implementation :: MicroPython',
3636
],
37+
setup_requires=['setuptools_scm'],
3738
platforms=["esp32", "linux", "darwin"],
3839
cmdclass={"sdist": sdist_upip.sdist},
3940
packages=["esp32_ulp"],

0 commit comments

Comments
 (0)