-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (47 loc) · 1.69 KB
/
publish_pypi_python_api.yaml
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
43
44
45
46
47
48
49
50
# Adapted from https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python APIs to PyPI (or TestPyPI)
on:
push:
tags:
- "api_release_[0-9]+_test[0-9]+"
- "api_release_[0-9]+"
workflow_dispatch:
jobs:
build-and-publish:
name: publish to PyPI (or TestPyPI)
runs-on: ubuntu-latest
strategy:
matrix:
package-path: [ml-agents-envs]
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.10.x
- name: Install dependencies
run: pip install setuptools wheel twine --user
- name: verify git tag vs. version
run: |
cd ${{ matrix.package-path }}
python setup.py verify
- name: Build package
run: |
cd ${{ matrix.package-path }}
python setup.py sdist
python setup.py bdist_wheel
- name: Publish distribution 📦 to Test PyPI
if: startsWith(github.ref, 'refs/tags') && contains(github.ref, 'test')
uses: actions/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295
with:
user: __token__
password: ${{ secrets.TEST_PYPI_PASSWORD }}
repository_url: https://test.pypi.org/legacy/
packages_dir: ${{ matrix.package-path }}/dist/
- name: Publish distribution 📦 to Production PyPI
if: startsWith(github.ref, 'refs/tags') && !contains(github.ref, 'test')
uses: actions/gh-action-pypi-publish@717ba43cfbb0387f6ce311b169a825772f54d295
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
packages_dir: ${{ matrix.package-path }}/dist/