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..f07bbee 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,34 @@ 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' + + - name: Bump version + if: ${{ steps.gitflow-action.outputs.release_branch }} + env: + VERSION: ${{ steps.gitflow-action.outputs.version }} + run: poetry version $VERSION + + - 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