From 52c9dd42f70df55b169ad0b48c45ff98023d8804 Mon Sep 17 00:00:00 2001 From: NekoAria <990879119@qq.com> Date: Mon, 13 Nov 2023 21:09:05 +0800 Subject: [PATCH] ci: fix packaging workflows --- .github/workflows/release.yml | 14 ++++++++++---- .github/workflows/testpypi.yml | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4cfd9562..d6e39ff9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,15 +16,21 @@ jobs: - name: Set up Python uses: actions/setup-python@v4.7.1 with: - python-version: ${{matrix.python-version}} + python-version: ${{ matrix.python-version }} - name: Install poetry run: pip install poetry - name: Install dependencies run: poetry install - - name: Build package - run: poetry build + - name: Build wheel + run: poetry build --format wheel + + # Conditionally build sdist + - name: Build sdist + if: matrix.python-version == '3.8' + run: poetry build --format sdist + - name: Publish package uses: pypa/gh-action-pypi-publish@v1.8.10 with: user: __token__ - password: ${{secrets.PYPI_TOKEN}} + password: ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/testpypi.yml b/.github/workflows/testpypi.yml index 70a3ee3d..b5a0146a 100644 --- a/.github/workflows/testpypi.yml +++ b/.github/workflows/testpypi.yml @@ -14,16 +14,22 @@ jobs: - name: Set up Python uses: actions/setup-python@v4.7.1 with: - python-version: ${{matrix.python-version}} + python-version: ${{ matrix.python-version }} - name: Install poetry run: pip install poetry - name: Install dependencies run: poetry install - - name: Build package - run: poetry build + - name: Build wheel + run: poetry build --format wheel + + # Conditionally build sdist + - name: Build sdist + if: matrix.python-version == '3.8' + run: poetry build --format sdist + - name: Publish package uses: pypa/gh-action-pypi-publish@v1.8.10 with: user: __token__ - password: ${{secrets.TESTPYPI_TOKEN}} + password: ${{ secrets.TESTPYPI_TOKEN }} repository_url: https://test.pypi.org/legacy/