From 02c5bc1199bd1fdf9f2a8e756b4c7cd78f21e1f1 Mon Sep 17 00:00:00 2001 From: Priyanshu Agarwal Date: Thu, 9 Sep 2021 15:22:32 +0530 Subject: [PATCH 1/4] Add python sdist --- .github/workflows/build_sdist.yml | 64 +++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/build_sdist.yml diff --git a/.github/workflows/build_sdist.yml b/.github/workflows/build_sdist.yml new file mode 100644 index 0000000000..8e9d4fb779 --- /dev/null +++ b/.github/workflows/build_sdist.yml @@ -0,0 +1,64 @@ +name: "Build and publish Python Source Distribution" + +on: + push: + branches: main + workflow_dispatch: + inputs: + target: + description: 'Deployment target. Can be "pypi" or "testpypi"' + default: 'pypi' + +jobs: + build_sdist: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Build sdist + run: python setup.py sdist --formats=gztar,zip + + - name: Upload sdist + uses: actions/upload-artifact@v2 + with: + name: files + path: | + ./dist/*.tar.gz + ./dist/*.zip + if-no-files-found: error + + + publish-pypi: + name: Upload sdist to PyPI + needs: build_sdist + runs-on: ubuntu-latest + steps: + - name: Download sdist + uses: actions/download-artifact@v2 + with: + name: files + + - name: Publish sdist on PyPI + if: github.event.inputs.target == 'pypi' + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + packages_dir: sdist/ + + - name: Publish sdist on TestPyPI + if: github.event.inputs.target == 'testpypi' + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.TESTPYPI_TOKEN }} + packages_dir: sdist/ + repository_url: https://test.pypi.org/legacy/ From 02409dca5fd6f7b37142325c24a8f6e16fd906ba Mon Sep 17 00:00:00 2001 From: Priyanshu Agarwal Date: Thu, 9 Sep 2021 15:51:47 +0530 Subject: [PATCH 2/4] Fix syntax --- .github/workflows/build_sdist.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build_sdist.yml b/.github/workflows/build_sdist.yml index 8e9d4fb779..7dc6b2096d 100644 --- a/.github/workflows/build_sdist.yml +++ b/.github/workflows/build_sdist.yml @@ -1,8 +1,6 @@ name: "Build and publish Python Source Distribution" on: - push: - branches: main workflow_dispatch: inputs: target: @@ -17,11 +15,12 @@ jobs: python-version: [3.8] steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} - name: Build sdist run: python setup.py sdist --formats=gztar,zip From 5609d64d281455a41eb75904296d31a4ed946b5e Mon Sep 17 00:00:00 2001 From: Priyanshu Agarwal Date: Thu, 9 Sep 2021 15:53:44 +0530 Subject: [PATCH 3/4] Specify main branch --- .github/workflows/build_sdist.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build_sdist.yml b/.github/workflows/build_sdist.yml index 7dc6b2096d..c79c00fcb9 100644 --- a/.github/workflows/build_sdist.yml +++ b/.github/workflows/build_sdist.yml @@ -1,6 +1,8 @@ name: "Build and publish Python Source Distribution" on: + push: + branches: main workflow_dispatch: inputs: target: From c8e66da15884a3e9fce16babd63a23aaed892111 Mon Sep 17 00:00:00 2001 From: Priyanshu Agarwal Date: Fri, 10 Sep 2021 11:02:07 +0530 Subject: [PATCH 4/4] Fix errors --- .github/workflows/build_sdist.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_sdist.yml b/.github/workflows/build_sdist.yml index c79c00fcb9..3a123a2b2c 100644 --- a/.github/workflows/build_sdist.yml +++ b/.github/workflows/build_sdist.yml @@ -1,4 +1,4 @@ -name: "Build and publish Python Source Distribution" +name: "Build and publish python sdist" on: push: @@ -11,6 +11,7 @@ on: jobs: build_sdist: + name: Build sdist runs-on: ubuntu-latest strategy: matrix: @@ -24,6 +25,9 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: pip install wheel + - name: Build sdist run: python setup.py sdist --formats=gztar,zip @@ -46,6 +50,7 @@ jobs: uses: actions/download-artifact@v2 with: name: files + path: sdist - name: Publish sdist on PyPI if: github.event.inputs.target == 'pypi'