From 587402a9b2af9a996fedeafb3749451c972b9b2a Mon Sep 17 00:00:00 2001 From: nilomr Date: Tue, 12 Nov 2024 13:03:12 +0000 Subject: [PATCH] Replace release_to_pypi.yml with ci-cd.yml --- .github/workflows/ci-cd.yml | 16 ++++++++ .github/workflows/release_to_pypi.yml | 58 --------------------------- 2 files changed, 16 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/ci-cd.yml delete mode 100644 .github/workflows/release_to_pypi.yml diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..438616b --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,16 @@ +# .github/workflows/ci-cd.yml +jobs: + pypi-publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + environment: + name: pypi + url: https://pypi.org/p/pykanto + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: + # retrieve your distributions here + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/.github/workflows/release_to_pypi.yml b/.github/workflows/release_to_pypi.yml deleted file mode 100644 index a64c1c6..0000000 --- a/.github/workflows/release_to_pypi.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Publish ${package_name} to PyPI / GitHub - -on: - push: - tags: - - "v*" - workflow_dispatch: - -jobs: - build-n-publish: - name: Build and publish to PyPI - runs-on: ubuntu-latest - - steps: - - name: Checkout source - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.9" - - - name: Build source and wheel distributions - run: | - python -m pip install --upgrade build twine - python -m build - twine check --strict dist/* - - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - - - name: Create GitHub Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: false - - - name: Get Asset name - run: | - export PKG=$(ls dist/ | grep tar) - set -- $PKG - echo "name=$1" >> $GITHUB_ENV - - name: Upload Release Asset (sdist) to GitHub - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: dist/${{ env.name }} - asset_name: ${{ env.name }} - asset_content_type: application/zip \ No newline at end of file