diff --git a/.github/workflows/packages.yaml b/.github/workflows/packages.yaml index 2f0cce827..a1b71498e 100644 --- a/.github/workflows/packages.yaml +++ b/.github/workflows/packages.yaml @@ -82,21 +82,29 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - cache: pip - cache-dependency-path: pyproject.toml - name: Install - run: | - pip install -U wheel pip build setuptools - pip install ".[all,tests]" + run: pip install -U wheel pip build setuptools_scm + + - name: Force version for Test PyPI uploads + if: ${{ !startsWith(github.ref, 'refs/tags') }} + run: echo version=$(python -m setuptools_scm | awk -F+ '{print $1}' | tail -1) >> $GITHUB_ENV - name: Build packages - run: | - pip install -U pip - ./scripts/build_package.sh + run: ./scripts/build_package.sh + env: + SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.version }} - name: Publish packages to PyPI if: github.event_name == 'release' uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_TOKEN }} + + - name: Publish to Test PyPI + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.TEST_PYPI_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + skip_existing: true diff --git a/pyproject.toml b/pyproject.toml index 420b3f300..11939ef55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ keywords = [ "collaboration", "ai", ] -license = { file = "LICENSE" } +license = { text = "Apache License 2.0" } authors = [{ name = "Dmitry Petrov", email = "dmitry@dvc.org" }] maintainers = [{ name = "Iterative", email = "support@dvc.org" }] requires-python = ">=3.8" @@ -131,9 +131,10 @@ dvc = "dvc.api:DVCFileSystem" [tool.setuptools] zip-safe = false +license-files = ["LICENSE"] [tool.setuptools.packages.find] -exclude = ["dvc.testing", "dvc.testing.*", "tests", "tests.*"] +exclude = ["tests", "tests.*"] [tool.setuptools_scm] write_to = "dvc/_dvc_version.py" diff --git a/scripts/build_package.sh b/scripts/build_package.sh index f9d8511e8..2b3501bc7 100755 --- a/scripts/build_package.sh +++ b/scripts/build_package.sh @@ -10,5 +10,5 @@ fi echo 'PKG = "pip"' >dvc/utils/build.py -python -m pip install -U build setuptools>=58.2 -python -m build --sdist --wheel --outdir dist/ +python -m pip install -U build setuptools>=61 +python -m build