From 404a9a4b7ff161f022e48c31b012b4affe97ebce Mon Sep 17 00:00:00 2001 From: Paolo Quadri Date: Wed, 27 Mar 2024 11:06:21 +0100 Subject: [PATCH] fix: releases depends on test, config pyproject.toml for semantic release --- .github/workflows/{tests.yml => ci.yml} | 18 ++++++++++++++++++ .github/workflows/release.yml | 24 ------------------------ pyproject.toml | 3 +++ 3 files changed, 21 insertions(+), 24 deletions(-) rename .github/workflows/{tests.yml => ci.yml} (75%) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/ci.yml similarity index 75% rename from .github/workflows/tests.yml rename to .github/workflows/ci.yml index 61adf8c..042652b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/ci.yml @@ -53,3 +53,21 @@ jobs: - name: Run tests run: poetry run pytest + + release: + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + concurrency: release + permissions: + id-token: write + contents: write + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Python Semantic Release + uses: python-semantic-release/python-semantic-release@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index a40daf5..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Semantic Release - -on: - push: - branches: - - main - -jobs: - release: - runs-on: ubuntu-latest - concurrency: release - permissions: - id-token: write - contents: write - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Python Semantic Release - uses: python-semantic-release/python-semantic-release@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 04f5319..ec5f573 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,3 +15,6 @@ pytest = "^8.1.1" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" + +[tool.semantic_release] +version_toml = ["pyproject.toml:tool.poetry.version"]