Skip to content

Commit

Permalink
Fix the CI: publish on release (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
Esadruhn committed Apr 21, 2021
1 parent 9ef1c39 commit 200f8bf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Python

on:
release:
types: [published]

jobs:
build_and_publish:
# See https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
# for making this job depend on the CI success
# needs: lint_and_tests
runs-on: ubuntu-latest
name: Build and publish
steps:
- uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install pypa/build
run: python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
21 changes: 0 additions & 21 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,3 @@ jobs:
cmp --silent references/sdk_schemas.md references/sdk_schemas.md.tmp
python bin/generate_sdk_schemas_documentation.py --models --output-path='references/sdk_models.md.tmp'
cmp --silent references/sdk_models.md references/sdk_models.md.tmp
build_and_publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: lint_and_tests
runs-on: ubuntu-latest
name: Build and publish
steps:
- uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install pypa/build
run: python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 200f8bf

Please sign in to comment.