Skip to content

Commit b230261

Browse files
committed
add publish workflow
1 parent 00dfe41 commit b230261

2 files changed

Lines changed: 61 additions & 2 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
name: Publish to PyPI
7+
8+
on:
9+
push:
10+
tags:
11+
- "v*"
12+
release:
13+
types: [published]
14+
workflow_dispatch:
15+
16+
jobs:
17+
release-build:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v5
22+
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.12"
26+
27+
- name: extract version from tag
28+
id: version
29+
run: echo "PACKAGE_VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
30+
31+
- name: build release distributions
32+
run: |
33+
python -m pip install build
34+
python -m build
35+
36+
- name: upload windows dists
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: release-dists
40+
path: dist/
41+
42+
pypi-publish:
43+
name: upload release to PyPI
44+
runs-on: ubuntu-latest
45+
needs:
46+
- release-build
47+
permissions:
48+
id-token: write
49+
50+
steps:
51+
- name: Retrieve release distributions
52+
uses: actions/download-artifact@v5
53+
with:
54+
name: release-dists
55+
path: dist/
56+
57+
- name: Publish release distributions to PyPI
58+
uses: pypa/gh-action-pypi-publish@release/v1

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
from setuptools import setup, find_packages
1+
import os
2+
from setuptools import setup, find_packages
23
from pathlib import Path
34

45
this_directory = Path(__file__).parent
56
long_description = (this_directory / "README.md").read_text()
67
NAME = "dataforseo-client"
7-
VERSION = "2.0.23"
8+
VERSION = os.environ["PACKAGE_VERSION"]
89
PYTHON_REQUIRES = ">=3.7"
910
REQUIRES = [
1011
"urllib3 >= 1.25.3",

0 commit comments

Comments
 (0)