From d54339c06dc90e6a0c50d1ee18dba84e9085c357 Mon Sep 17 00:00:00 2001 From: youben11 Date: Tue, 25 Jan 2022 16:10:38 +0100 Subject: [PATCH] ci: add workflow to push python packages --- .github/workflows/push-python-packages.yml | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/push-python-packages.yml diff --git a/.github/workflows/push-python-packages.yml b/.github/workflows/push-python-packages.yml new file mode 100644 index 000000000..d71874c6b --- /dev/null +++ b/.github/workflows/push-python-packages.yml @@ -0,0 +1,45 @@ +name: Push Python Packages + +on: + workflow_dispatch: + inputs: + internal_pypi: + description: 'Whether to push to internal pypi' + required: true + type: boolean + public_pypi: + description: 'Whether to push to public pypi' + default: 'false' + required: true + type: boolean + tag: + description: 'Release tag to push' + required: true + +jobs: + PushPackages: + runs-on: ubuntu-latest + + steps: + - name: Download release assets + uses: duhow/download-github-release-assets@v1 + with: + token: ${{ secrets.GH_TOKEN }} + repository: ${{ github.repository }} + tag: ${{ github.event.inputs.tag }} + files: '*' + target: ${{ github.workspace }}/release/ + + - name: Install dependencies + if: ${{ github.event.inputs.internal_pypi || github.event.inputs.public_pypi }} + run: | + python -m pip install --upgrade pip + pip install twine + + - name: Push packages to internal pypi + if: ${{ github.event.inputs.internal_pypi }} + run: twine upload -u ${{ secrets.INTERNAL_PYPI_USER }} -p ${{ secrets.INTERNAL_PYPI_PASSWORD }} --repository-url ${{ secrets.INTERNAL_PYPI_URL }} ${{ github.workspace }}/release/*.whl + + - name: Push packages to public pypi + if: ${{ github.event.inputs.public_pypi }} + run: twine upload -u ${{ secrets.PUBLIC_PYPI_USER }} -p ${{ secrets.PUBLIC_PYPI_PASSWORD }} -r pypi ${{ github.workspace }}/release/*.whl