Skip to content

Commit 87a8d40

Browse files
committed
Add workflow to publish to PyPI and TestPyPI
Signed-off-by: Boris Glimcher <[email protected]>
1 parent d8a6b84 commit 87a8d40

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
push:
15+
branches: [ main ]
16+
# Publish semver tags as releases.
17+
tags: [ 'v*.*.*' ]
18+
pull_request:
19+
branches: [ main ]
20+
21+
workflow_dispatch:
22+
23+
jobs:
24+
deploy:
25+
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- uses: actions/checkout@v2
30+
- name: Set up Python
31+
uses: actions/setup-python@v2
32+
with:
33+
python-version: '3.x'
34+
- name: Install dependencies
35+
run: |
36+
sudo apt-get install libjson-c-dev meson
37+
python -m pip install --upgrade pip
38+
pip install build
39+
- name: Build package
40+
run: python -m build --sdist
41+
- name: Publish package to TestPyPI
42+
uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
user: __token__
45+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
46+
repository_url: https://test.pypi.org/legacy/
47+
- name: Publish package to PyPI
48+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
49+
uses: pypa/gh-action-pypi-publish@release/v1
50+
with:
51+
user: __token__
52+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)