From 30f99bc276da19c339d9f1d38455aff302946e83 Mon Sep 17 00:00:00 2001 From: Pete Grayson Date: Tue, 7 Apr 2020 12:28:53 -0400 Subject: [PATCH] Add publish job to CI action This new job publishes tagged builds to PyPI. --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a9d5c80..406bdb41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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