diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 328fa21..23fff42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,3 +47,24 @@ jobs: with: name: coverage-report-py${{ matrix.python-version }} path: htmlcov/ + + create_wheel_and_sdist: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v7 + + - name: Install uv + uses: astral-sh/setup-uv@v8.3.2 + with: + python-version: '3.13' + + - name: Build wheel and sdist + run: uv build + + - name: Upload wheel and sdist as artifact + uses: actions/upload-artifact@v7 + with: + name: Package-Distributions-construct-editor + path: dist/ \ No newline at end of file diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 4e1ef42..f97476f 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -1,6 +1,3 @@ -# This workflows will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - name: Upload Python Package on: @@ -8,24 +5,26 @@ on: types: [created] jobs: - deploy: + create_wheel_and_sdist: + name: create_wheel_and_sdist + uses: ./.github/workflows/ci.yml + deploy: + needs: [ create_wheel_and_sdist ] runs-on: ubuntu-latest + + environment: pypi + permissions: + id-token: write # IMPORTANT: this permission is mandatory for Trusted Publishing steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + - uses: actions/checkout@v7 + + - name: Download artifacts + uses: actions/download-artifact@v8 + with: + name: Package-Distributions-construct-editor + path: ./dist + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file