Skip to content

Commit 7e3ba5b

Browse files
committed
Add release workflow
1 parent b8bf29b commit 7e3ba5b

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2+
on:
3+
push:
4+
tags:
5+
- '[0-9]+.[0-9]+.[0-9]+'
6+
release:
7+
types:
8+
- published
9+
jobs:
10+
build-n-publish:
11+
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@master
15+
16+
- name: Set up Python 3.10
17+
uses: actions/setup-python@v1
18+
with:
19+
python-version: 3.10
20+
21+
- name: Update version
22+
run: sed -i "s/version = .*/version = '${{github.ref_name}}'/" pyproject.toml
23+
24+
- name: Build a binary wheel and a source tarball
25+
run: poetry build
26+
27+
- name: Publish distribution 📦 to Test PyPI
28+
if: github.event_name == 'push'
29+
uses: pypa/gh-action-pypi-publish@v1.5.0
30+
with:
31+
user: __token__
32+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
33+
repository_url: https://test.pypi.org/legacy/
34+
35+
- name: Publish distribution 📦 to PyPI if triggered by release
36+
if: github.event_name == 'release'
37+
uses: pypa/gh-action-pypi-publish@v1.5.0
38+
with:
39+
user: __token__
40+
password: ${{ secrets.PYPI_API_TOKEN }}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "py_swagger_ui"
3-
version = "1.0.0"
3+
version = 'test'
44
description = "Swagger UI bundled for usage with Python"
55
readme = "README.rst"
66
keywords = ["swagger-ui"]

0 commit comments

Comments
 (0)