diff --git a/.github/workflows/_publish_to_pypi.yaml b/.github/workflows/_publish_to_pypi.yaml deleted file mode 100644 index ecb80034b..000000000 --- a/.github/workflows/_publish_to_pypi.yaml +++ /dev/null @@ -1,75 +0,0 @@ -name: Publish to PyPI - -on: - workflow_call: - inputs: - package_name: - required: true - type: string - version_number: - required: true - type: string - is_prerelease: - required: true - type: string - -env: - PYTHON_VERSION: 3.12 - -jobs: - publish_to_pypi: - name: Publish to PyPI - runs-on: ubuntu-latest - permissions: - contents: write - id-token: write # Required for OIDC authentication. - environment: - name: pypi - url: https://pypi.org/project/${{ inputs.package_name }} - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - - - name: Install dependencies - run: | - pipx install --python ${{ env.PYTHON_VERSION }} poetry - make install-dev - - # Updates the version number in the project's configuration. - - name: Set version in pyproject.toml - run: | - if [ -n "${{ inputs.is_prerelease }}" ]; then - next_beta=$( - curl "https://pypi.org/pypi/${{ inputs.package_name }}/json" | jq --raw-output ' - [ - .releases | - keys | - .[] | - select(startswith("${{ inputs.version_number }}b")) | - split("b") | - .[1] | - tonumber - ] | - sort_by(- .) | - .[0] + 1 - ' - ) - poetry version "${{ inputs.version_number }}b$next_beta" - else - # ...and a regular release otherwise - poetry version '${{ inputs.version_number }}' - fi - - # Builds the package. - - name: Build package - run: make build - - # Publishes the package to PyPI using PyPA official GitHub action with OIDC authentication. - - name: Publish package to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/pre_release.yaml b/.github/workflows/pre_release.yaml index 705d6abef..53920bdcc 100644 --- a/.github/workflows/pre_release.yaml +++ b/.github/workflows/pre_release.yaml @@ -80,10 +80,11 @@ jobs: publish_to_pypi: name: Publish to PyPI needs: [release_metadata, update_changelog] - uses: ./.github/workflows/_publish_to_pypi.yaml + uses: apify/workflows/.github/workflows/python_publish_to_pypi.yaml@release-metadata-action # TODO change branch to main with: package_name: crawlee version_number: ${{ needs.release_metadata.outputs.version_number }} + ref: ${{ needs.update_changelog.changelog_commitish }} is_prerelease: "yes" # TODO: add job for publish package to Conda diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f6128025a..36b6dbe95 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -111,10 +111,11 @@ jobs: publish_to_pypi: name: Publish to PyPI needs: [release_metadata, update_changelog] - uses: ./.github/workflows/_publish_to_pypi.yaml + uses: apify/workflows/.github/workflows/python_publish_to_pypi.yaml@release-metadata-action # TODO change branch to main with: package_name: crawlee version_number: ${{ needs.release_metadata.outputs.version_number }} + ref: ${{ needs.update_changelog.changelog_commitish }} is_prerelease: '' # TODO: add job for publish package to Conda