Skip to content

Commit

Permalink
Combine CI workflows for testing and release upload to PyPI (we want …
Browse files Browse the repository at this point in the history
…tests to run and pass before a release is uploaded) (#291)
  • Loading branch information
GenevieveBuckley committed Mar 14, 2023
1 parent 8684ac2 commit d25a129
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/python-publish.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: CI
name: test_and_deploy

on:
push:
branches:
- main
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:

jobs:
Expand Down Expand Up @@ -48,7 +50,7 @@ jobs:
parallel: true
path-to-lcov: coverage.lcov

finish:
coveralls:
needs: test
runs-on: ubuntu-latest
steps:
Expand All @@ -57,3 +59,32 @@ jobs:
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true

deploy:
# This will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
#
# This job will run when you have tagged a commit, starting with "v*"
# or created a release in GitHub which includes a tag starting with "v*"
# and requires that you have put your twine API key in your
# github secrets (see readme for details)
needs: [test]
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*

0 comments on commit d25a129

Please sign in to comment.