Skip to content

Commit

Permalink
ci: push package to test.pypi.org (iterative#8495)
Browse files Browse the repository at this point in the history
* ci: push package to test.pypi.org

* include dvc.testing and license file
  • Loading branch information
skshetry authored Oct 31, 2022
1 parent c8e3952 commit 120a587
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ keywords = [
"collaboration",
"ai",
]
license = { file = "LICENSE" }
license = { text = "Apache License 2.0" }
authors = [{ name = "Dmitry Petrov", email = "[email protected]" }]
maintainers = [{ name = "Iterative", email = "[email protected]" }]
requires-python = ">=3.8"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions scripts/build_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 120a587

Please sign in to comment.