From 7b1fe262717c81f3827f613aab8158f3b4906563 Mon Sep 17 00:00:00 2001 From: Mihails Delmans Date: Wed, 8 Jan 2025 16:41:00 +0000 Subject: [PATCH 1/6] Add build/publish steps to release workflow --- .github/workflows/pull.yml | 2 ++ .github/workflows/release.yml | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 1ddaf72..8057cb6 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -19,6 +19,8 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} - name: Install Python uses: actions/setup-python@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c7535a7..c967837 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,6 +23,7 @@ jobs: steps: - name: Gitflow action + id: gitflow-action uses: hoangvvo/gitflow-workflow-action@0.3.7 with: develop_branch: "fake_develop" @@ -31,4 +32,36 @@ jobs: version_increment: ${{ contains(github.head_ref, 'hotfix/') && 'patch' || '' }} dry_run: ${{ inputs.dry_run }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ steps.gitflow-action.output.release_branch || 'fake_main' }} + + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install Poetry + uses: abatilo/actions-poetry@v2 + with: + poetry-version: 'latest' + + - name: Bump version + if: ${{ steps.gitflow-action.output.release_branch }} + env: + VERSION: ${{ steps.gitflow-action.output.version }} + run: poetry version $VERSION + + - name: + + - name: Build and publish package + if: ${{ !steps.gitflow-action.output.release_branch }} + env: + TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} + run: | + poetry config repositories.testpypi https://test.pypi.org/legacy/ + poetry config pypi-token.testpypi $TEST_PYPI_TOKEN + poetry publish --build --dry-run \ No newline at end of file From 3e147543134440899da3d60e617d3ba4cc8bc80f Mon Sep 17 00:00:00 2001 From: Mihails Delmans Date: Wed, 8 Jan 2025 16:48:09 +0000 Subject: [PATCH 2/6] Fix release worklfow defs --- .github/workflows/release.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c967837..57d8cd8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,9 +35,9 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ steps.gitflow-action.output.release_branch || 'fake_main' }} + uses: actions/checkout@v4 + with: + ref: ${{ steps.gitflow-action.output.release_branch || 'fake_main' }} - name: Install Python uses: actions/setup-python@v5 @@ -54,8 +54,6 @@ jobs: env: VERSION: ${{ steps.gitflow-action.output.version }} run: poetry version $VERSION - - - name: - name: Build and publish package if: ${{ !steps.gitflow-action.output.release_branch }} From 64f10a4cfe5e7ac9d597ac8fd0efde21221a722c Mon Sep 17 00:00:00 2001 From: Mihails Delmans Date: Wed, 8 Jan 2025 16:51:28 +0000 Subject: [PATCH 3/6] Fix output -> outputs in the release workflow tml --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 57d8cd8..f07bbee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,7 @@ jobs: - name: Checkout code uses: actions/checkout@v4 with: - ref: ${{ steps.gitflow-action.output.release_branch || 'fake_main' }} + ref: ${{ steps.gitflow-action.outputs.release_branch || 'fake_main' }} - name: Install Python uses: actions/setup-python@v5 @@ -50,13 +50,13 @@ jobs: poetry-version: 'latest' - name: Bump version - if: ${{ steps.gitflow-action.output.release_branch }} + if: ${{ steps.gitflow-action.outputs.release_branch }} env: - VERSION: ${{ steps.gitflow-action.output.version }} + VERSION: ${{ steps.gitflow-action.outputs.version }} run: poetry version $VERSION - name: Build and publish package - if: ${{ !steps.gitflow-action.output.release_branch }} + if: ${{ !steps.gitflow-action.outputs.release_branch }} env: TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} run: | From 9b847001e78b858e230b1a2c096ba9ec1c5195f9 Mon Sep 17 00:00:00 2001 From: Mihails Delmans Date: Wed, 8 Jan 2025 16:58:12 +0000 Subject: [PATCH 4/6] Add auto-commit step for version update in the release workflow --- .github/workflows/release.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f07bbee..3c989ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,12 +49,19 @@ jobs: with: poetry-version: 'latest' + # Bumping version if we are in the 'create release PR mode' - name: Bump version if: ${{ steps.gitflow-action.outputs.release_branch }} env: VERSION: ${{ steps.gitflow-action.outputs.version }} run: poetry version $VERSION + + # Committing bumped version to the release branch + - name: Commit new version + if: ${{ steps.gitflow-action.outputs.release_branch }} + uses: stefanzweifel/git-auto-commit-action@v5 + # Building and publishing if we are in 'created new release mode' - name: Build and publish package if: ${{ !steps.gitflow-action.outputs.release_branch }} env: From d5bf4d5c53ce91ef562c8fba4db8752b49f1d4a3 Mon Sep 17 00:00:00 2001 From: Mihails Delmans Date: Wed, 8 Jan 2025 17:01:04 +0000 Subject: [PATCH 5/6] Add a commit message for version bump in the release workflow --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c989ad..540988f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,6 +60,8 @@ jobs: - name: Commit new version if: ${{ steps.gitflow-action.outputs.release_branch }} uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "Bump version to ${{ steps.gitflow-action.outputs.version }}" # Building and publishing if we are in 'created new release mode' - name: Build and publish package From b0cc14287ec34506e42b4d6b55392d0de13beed9 Mon Sep 17 00:00:00 2001 From: mdelmans Date: Wed, 8 Jan 2025 17:01:46 +0000 Subject: [PATCH 6/6] Bump version to 0.12.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c0b09ae..22cb9e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "python-notion-api" -version = "0.10.0" +version = "0.12.0" description = "Python wrapper for the official Notion API" authors = [ "Mihails Delmans ",