From 1f51bed001498c2cfa01cd0b7a5a8527fe2f6483 Mon Sep 17 00:00:00 2001 From: Auke Willem Oosterhoff Date: Mon, 6 Jan 2020 13:55:35 +0100 Subject: [PATCH 1/3] Publish Python wheels on pypi on every git tag --- .github/workflows/main.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index da8ffefba386..db961402f7d4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,7 @@ name: CI on: push: - branches: [master] + branches: [master, deploy-python-wheel-to-pypi] tags-ignore: [dev] pull_request: branches: [master] @@ -408,7 +408,7 @@ jobs: # github releases and/or tags for pushes. publish: name: Publish - needs: [doc_book, doc_api, wheels, build] + needs: [doc_book, doc_api, wheels, build, wheels] runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -493,6 +493,25 @@ jobs: name: tarballs path: dist + # The action 'pypa/gh-action-pypi-publish' will try to upload all files in the + # dist/ folder. This folder also contains non-package files, and therefore the + # action fails. + # + # To prevent the action from failing all .whl files are copied into a new + # directory. + - run: | + mkdir -p tmp/whl + find dist/ -name '*.whl' -type f -exec cp '{}' tmp/whl -v \; + + - name: Publish Python wheels on Pypi + uses: pypa/gh-action-pypi-publish@master + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') + with: + user: __token__ + password: ${{ secrets.pypi_password }} + packages_dir: tmp/whl + repository_url: https://test.pypi.org/legacy/ + # ... and if this was an actual push (tag or `master`) then we publish a # new release. This'll automatically publish a tag release or update `dev` # with this `sha` @@ -503,3 +522,4 @@ jobs: files: "dist/*" name: ${{ steps.tagname.outputs.val }} token: ${{ secrets.GITHUB_TOKEN }} + From 970313b1cb8eb583b681b54cd07601055e26fe61 Mon Sep 17 00:00:00 2001 From: Auke Willem Oosterhoff Date: Mon, 6 Jan 2020 14:32:22 +0100 Subject: [PATCH 2/3] Remove config required for testing --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index db961402f7d4..e1d47bb69df2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,7 +1,7 @@ name: CI on: push: - branches: [master, deploy-python-wheel-to-pypi] + branches: [master] tags-ignore: [dev] pull_request: branches: [master] @@ -510,7 +510,6 @@ jobs: user: __token__ password: ${{ secrets.pypi_password }} packages_dir: tmp/whl - repository_url: https://test.pypi.org/legacy/ # ... and if this was an actual push (tag or `master`) then we publish a # new release. This'll automatically publish a tag release or update `dev` From 5223acbb239f185c5721c0ebcccf9f85967f7a7c Mon Sep 17 00:00:00 2001 From: Auke Willem Oosterhoff Date: Mon, 6 Jan 2020 19:44:27 +0100 Subject: [PATCH 3/3] Pin workflow version & remove duplicate dependency --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e1d47bb69df2..93522c43e1a9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -408,7 +408,7 @@ jobs: # github releases and/or tags for pushes. publish: name: Publish - needs: [doc_book, doc_api, wheels, build, wheels] + needs: [doc_book, doc_api, wheels, build] runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 @@ -504,7 +504,7 @@ jobs: find dist/ -name '*.whl' -type f -exec cp '{}' tmp/whl -v \; - name: Publish Python wheels on Pypi - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@v1.0.0a0 if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') with: user: __token__