Skip to content

Commit 69f7f35

Browse files
Williangalvanipatrickelectric
authored andcommitted
CI: create deployment for PYPi
1 parent 2e0f287 commit 69f7f35

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Deploy to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # This will trigger the workflow only when a tag that matches the pattern is pushed
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout Code
14+
uses: actions/checkout@v2
15+
with:
16+
submodules: recursive
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: '3.x'
22+
23+
- name: Check Tag and setup.py Version Match
24+
run: |
25+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
26+
SETUP_VERSION=$(grep -oE "version='([^']+)" setup.py | grep -oE '[^=]+$')
27+
if [[ "$TAG_VERSION" != "$SETUP_VERSION" ]]; then
28+
echo "Tag version $TAG_VERSION does not match setup.py version $SETUP_VERSION."
29+
exit 1
30+
fi
31+
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install jinja2 setuptools wheel
36+
generate/generate-python.py --output-dir=brping
37+
38+
- name: Build package
39+
run: |
40+
python setup.py sdist bdist_wheel
41+
42+
- name: Build and Publish
43+
uses: pypa/gh-action-pypi-publish@v1.8.10
44+
with:
45+
user: __token__
46+
password: ${{ secrets.PYPI_TOKEN }}
47+
distributions: "sdist bdist_wheel"

0 commit comments

Comments
 (0)