From 4cdc87cba44f614ec8b30542f79a95d54ecd954c Mon Sep 17 00:00:00 2001 From: Marcin Stolarek Date: Thu, 9 May 2024 13:43:41 +0200 Subject: [PATCH] Fix automatic publishing to pypi --- .github/workflows/publish.yml | 55 ++++++++++++++++++++++++++++------- setup.cfg | 2 +- 2 files changed, 46 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d768a21d..a1e6edeb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,45 @@ -- name: Publish package - on: - push: - branches: - - main - tags: - - v0.0.* - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_TOKEN }} +name: Publish to PyPi +on: + push: + branches: + - main +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + pypi-publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + needs: + - build + environment: + name: pypi + url: https://pypi.org/p/ansible-deployer + 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 diff --git a/setup.cfg b/setup.cfg index a231c819..8dc80e43 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = ansible-deployer -version = 0.0.45 +version = 0.0.46 description = Wrapper around ansible-playbook allowing configurable tasks and permissions long_description = file: README.md long_description_content_type = text/markdown; charset=UTF-8