Skip to content

Commit

Permalink
Add publish job to CI action
Browse files Browse the repository at this point in the history
This new job publishes tagged builds to PyPI.
  • Loading branch information
jpgrayson committed Apr 7, 2020
1 parent 18c4e7a commit 30f99bc
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Expand Up @@ -89,3 +89,38 @@ jobs:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
make coverage && coveralls
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest

steps:
- name: Download dist build
uses: actions/download-artifact@v1
with:
name: desmod-dist
- name: Print dists
run: |
ls desmod-dist/
- name: Prepare dists for test
shell: bash
run: |
test_tgz=$(ls desmod-dist/desmod-*.tar.gz | sed 's/\+g[a-f0-9]\{7\}\.tar.gz/.tar.gz/g')
test_whl=$(ls desmod-dist/desmod-*.whl | sed 's/\+g[a-f0-9]\{7\}\.whl/.whl/g')
mkdir test-dist
cp desmod-dist/desmod-*.tar.gz test-dist/"$test_tgz"
cp desmod-dist/desmod-*.whl test-dist/"$test_whl"
- name: Test Publish
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.testpypi_password }}
packages_dir: test-dist
- name: Publish dists
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
packages_dir: desmod-dist

0 comments on commit 30f99bc

Please sign in to comment.