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..540988f 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,43 @@ 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.outputs.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' + + # 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 + 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 + if: ${{ !steps.gitflow-action.outputs.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 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 ",