-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (36 loc) · 1.15 KB
/
release.yml
File metadata and controls
42 lines (36 loc) · 1.15 KB
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
name: Publish to PyPI
on:
push:
tags:
- 'v*' # This triggers the action for tags starting with "v" (e.g., v0.1.0)
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
# Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # You can specify a more specific version like '3.8' if needed
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
# Build the distribution
- name: Build distribution
run: |
CURRENT_TAG=$(git describe --tags --abbrev=0)
VERSION=${CURRENT_TAG#v} # Remove 'v' from the tag
sed -i "s/version=\"[^\"]*\"/version=\"$VERSION\"/" setup.py
python setup.py sdist bdist_wheel
# Upload the distribution to PyPI
- name: Upload to PyPI
run: |
twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PIPY_API_TOKEN }}