From 9368021c8d2ddea09d898ef22cf240f6b73e1d27 Mon Sep 17 00:00:00 2001 From: iva-romanenko Date: Wed, 15 May 2024 10:19:50 +0200 Subject: [PATCH] Update release process with and python semantic version release --- .github/workflows/release.yml | 25 +++++++++++++++++++------ Makefile | 3 --- requirements-dev.txt | 1 - 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12963ab2..7cbcb040 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,16 +20,29 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - - name: Bump version and release to PyPi + - name: Configure python and git user run: | make deps git config --global user.name 'Yandex.Cloud Bot' git config --global user.email 'ycloud-bot@yandex.ru' - make release - env: - REPOSITORY_USERNAME: __token__ - REPOSITORY_PASSWORD: ${{ secrets.PYPI_TOKEN }} + - name: Python Semantic Release + id: release + uses: python-semantic-release/python-semantic-release@v9.7.2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + # NOTE: DO NOT wrap the conditional in ${{ }} as it will always evaluate to true. + # See https://github.com/actions/runner/issues/1173 + if: steps.release.outputs.released == 'true' + + - name: Publish package distributions to GitHub Releases + uses: python-semantic-release/upload-to-gh-release@main + if: steps.release.outputs.released == 'true' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index d82102cd..f70ac75f 100644 --- a/Makefile +++ b/Makefile @@ -45,9 +45,6 @@ proto: ## regenerate code from protobuf `find cloudapi/yandex -name '*.proto'` find yandex -type d -exec touch {}/__init__.py \; -release: ## update changelog, bump version, build and publish package to pypi - python -m semantic_release publish --minor - help: ## Show help message @IFS=$$'\n' ; \ help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \ diff --git a/requirements-dev.txt b/requirements-dev.txt index 3f3fb27b..b90e347f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -5,6 +5,5 @@ isort mccabe pylint pytest -python-semantic-release<8.0.0 tox tox-gh-actions