-
Notifications
You must be signed in to change notification settings - Fork 1.4k
39 lines (33 loc) · 1.13 KB
/
release_esptool_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
# This workflow will upload an esptool Python package when a release is created
name: PyPI release
on:
release:
types: [released]
jobs:
build_and_upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@master
with:
python-version: '3.7'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine build
- name: Build and upload esptool ${{ github.event.release.tag_name }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
PUBLISHED_VERSION=$(curl https://pypi.org/pypi/esptool/json 2>/dev/null | jq -r '.info.version')
CURRENT_VERSION=$(python setup.py --version 2>/dev/null)
if [ "$PUBLISHED_VERSION" == "$CURRENT_VERSION" ]; then
echo "Version ${PUBLISHED_VERSION} already published, skipping..."
exit 1
else
echo "Packaging and publishing new esptool version: ${CURRENT_VERSION}"
python -m build --sdist
twine upload dist/*
fi