Skip to content

Commit 120a587

Browse files
authored
ci: push package to test.pypi.org (iterative#8495)
* ci: push package to test.pypi.org * include dvc.testing and license file
1 parent c8e3952 commit 120a587

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

.github/workflows/packages.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,21 +82,29 @@ jobs:
8282
uses: actions/setup-python@v4
8383
with:
8484
python-version: 3.8
85-
cache: pip
86-
cache-dependency-path: pyproject.toml
8785

8886
- name: Install
89-
run: |
90-
pip install -U wheel pip build setuptools
91-
pip install ".[all,tests]"
87+
run: pip install -U wheel pip build setuptools_scm
88+
89+
- name: Force version for Test PyPI uploads
90+
if: ${{ !startsWith(github.ref, 'refs/tags') }}
91+
run: echo version=$(python -m setuptools_scm | awk -F+ '{print $1}' | tail -1) >> $GITHUB_ENV
9292

9393
- name: Build packages
94-
run: |
95-
pip install -U pip
96-
./scripts/build_package.sh
94+
run: ./scripts/build_package.sh
95+
env:
96+
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ env.version }}
9797

9898
- name: Publish packages to PyPI
9999
if: github.event_name == 'release'
100100
uses: pypa/gh-action-pypi-publish@release/v1
101101
with:
102102
password: ${{ secrets.PYPI_TOKEN }}
103+
104+
- name: Publish to Test PyPI
105+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
106+
uses: pypa/gh-action-pypi-publish@release/v1
107+
with:
108+
password: ${{ secrets.TEST_PYPI_TOKEN }}
109+
repository_url: https://test.pypi.org/legacy/
110+
skip_existing: true

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ keywords = [
1616
"collaboration",
1717
"ai",
1818
]
19-
license = { file = "LICENSE" }
19+
license = { text = "Apache License 2.0" }
2020
authors = [{ name = "Dmitry Petrov", email = "[email protected]" }]
2121
maintainers = [{ name = "Iterative", email = "[email protected]" }]
2222
requires-python = ">=3.8"
@@ -131,9 +131,10 @@ dvc = "dvc.api:DVCFileSystem"
131131

132132
[tool.setuptools]
133133
zip-safe = false
134+
license-files = ["LICENSE"]
134135

135136
[tool.setuptools.packages.find]
136-
exclude = ["dvc.testing", "dvc.testing.*", "tests", "tests.*"]
137+
exclude = ["tests", "tests.*"]
137138

138139
[tool.setuptools_scm]
139140
write_to = "dvc/_dvc_version.py"

scripts/build_package.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ fi
1010

1111
echo 'PKG = "pip"' >dvc/utils/build.py
1212

13-
python -m pip install -U build setuptools>=58.2
14-
python -m build --sdist --wheel --outdir dist/
13+
python -m pip install -U build setuptools>=61
14+
python -m build

0 commit comments

Comments
 (0)