diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4e25f9..45d1f06 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,14 +23,8 @@ jobs: - name: Upload source distribution uses: actions/upload-artifact@v3 with: - name: sdist - path: "dist/*.tar.gz" - if-no-files-found: error - - name: Upload wheel - uses: actions/upload-artifact@v3 - with: - name: wheel - path: "dist/*.whl" + name: build-output + path: "dist/*" if-no-files-found: error test: @@ -74,7 +68,7 @@ jobs: - name: Download wheel uses: actions/download-artifact@v3 with: - name: wheel + name: build-output path: dist/ - name: Install wheel @@ -85,3 +79,33 @@ jobs: - name: Test with pytest run: | pytest + + deploy: + runs-on: ubuntu-latest + needs: [build, test] + + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: build-output + path: dist/ + + - name: Deploy to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: startsWith(github.ref, 'refs/head/master') + with: + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + files: dist/* + + - name: Deploy to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: startsWith(github.ref, 'refs/tags/v') + with: + password: ${{ secrets.PYPI_API_TOKEN }}