From 4404e3d5ea294b65be7602a9c29be8542ede550d Mon Sep 17 00:00:00 2001 From: Yefu Wang <1yefuwang1@gmail.com> Date: Mon, 1 Jul 2024 22:43:38 +0800 Subject: [PATCH] add upload-wheel --- .github/workflows/upload-wheel.yml | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/upload-wheel.yml diff --git a/.github/workflows/upload-wheel.yml b/.github/workflows/upload-wheel.yml new file mode 100644 index 0000000..198ff80 --- /dev/null +++ b/.github/workflows/upload-wheel.yml @@ -0,0 +1,49 @@ +name: Upload wheels + +on: + workflow_dispatch: + inputs: + pypi_test: + description: 'Upload to test.pypi.org' + required: false + default: 'true' + type: 'boolean' + +jobs: + upload_wheels: + name: Upload wheels + runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + + steps: + - uses: actions/checkout@v4 + + - uses: benjlevesque/short-sha@v3.0 + id: short_sha + + # Download artifact + - uses: actions/download-artifact@v4 + with: + name: vectorlite-${{ matrix.os }}-${{ steps.short_sha.outputs.sha }} + path: ./wheelhouse + + - uses: actions/setup-python@v5 + + - name: Install twine + run: python -m pip install twine + + - name: Upload to test.pypi.org + if: ${{ github.event.inputs.pypi_test == 'true' }} + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} + run: python -m twine upload --repository testpypi wheelhouse/*.whl + + - name: Upload to pypi.org + if: ${{ github.event.inputs.pypi_test == 'false' }} + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: python -m twine upload wheelhouse/*.whl