From 5fdfbe511d1c37c0938dca81b258d7d6cc5ccd04 Mon Sep 17 00:00:00 2001 From: Meow King Date: Wed, 31 Jul 2024 16:16:12 +0800 Subject: [PATCH] test(ci): upload to pypi --- .github/workflows/buildwheels.yml | 57 +++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildwheels.yml b/.github/workflows/buildwheels.yml index 00098d5..cc1f231 100644 --- a/.github/workflows/buildwheels.yml +++ b/.github/workflows/buildwheels.yml @@ -4,13 +4,31 @@ on: workflow_dispatch: jobs: + build_sdist: + name: Build SDist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + + - name: Build SDist + run: pipx run build --sdist + + - name: Check metadata + run: pipx run twine check dist/* + + - uses: actions/upload-artifact@v4 + with: + name: dist-sdist + path: dist/*.tar.gz + build_wheels: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: # macos-13 is an intel runner, macos-14 is apple silicon - # os: [ubuntu-latest, windows-latest, macos-13, macos-14] os: [ubuntu-latest, macos-14, windows-latest] steps: @@ -34,7 +52,40 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.19.2 - - uses: actions/upload-artifact@v4 + - name: Upload wheels artifacts + uses: actions/upload-artifact@v4 with: - name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + name: dist-${{ matrix.os }} path: ./wheelhouse/*.whl + + + merge_wheels: + name: Merge wheels into a combined artifact + runs-on: ubuntu-latest + needs: [build_wheels, build_sdist] + steps: + - name: Merge Artifacts + uses: actions/upload-artifact/merge@v4 + with: + name: dist + pattern: dist-* + + pypi-publish: + name: Upload if release + needs: merge_wheels + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/llvmpym + permissions: + id-token: write + + steps: + - uses: actions/setup-python@v5 + + - uses: actions/download-artifact@v4 + with: + path: dist + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1