Skip to content

Commit 52bd0ee

Browse files
committed
Claim all existing packages on pypi
1 parent cf9f823 commit 52bd0ee

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: build ddev
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
defaults:
9+
run:
10+
shell: bash
11+
12+
13+
jobs:
14+
python-artifacts:
15+
name: Build wheel and source distribution
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python 3.11
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: 3.11
26+
27+
- name: Install Build
28+
run: pip install -U build[virtualenv]
29+
30+
- name: build packages
31+
run: |
32+
bash .github/workflows/scripts/build.sh
33+
34+
# - name: Push Python artifacts to PyPI
35+
# uses: pypa/gh-action-pypi-publish@v1.8.14
36+
# with:
37+
# skip-existing: true
38+
# user: __token__
39+
# password: ${{ secrets.INTEGRATIONS_PYPI_NAME_CLAIM }}

.github/workflows/scripts/build.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
# Requires python 3.11+ (for tomllib) and the `build` package.
4+
# Run this script from the root of the repo.
5+
# The TL;DR of this script is: for every subdirectory with a pyproject.toml file we build an empty Python wheel.
6+
7+
mkdir -p dist
8+
mkdir -p pkg_placeholder
9+
for file_or_subdir in *; do
10+
if [[ -d "${file_or_subdir}" ]]; then
11+
pyproject="${file_or_subdir}/pyproject.toml"
12+
if [[ -f "${pyproject}" ]]; then
13+
pypi_pkg_name=$(python -c "import tomllib, pathlib; contents = pathlib.Path('${pyproject}').read_text(); data = tomllib.loads(contents); print(data['project']['name'])")
14+
# multiline strings are sensitive to indentation, so we must unindent the following command
15+
cat <<EOF > pkg_placeholder/pyproject.toml
16+
[build-system]
17+
requires = ["hatchling"]
18+
build-backend = "hatchling.build"
19+
[project]
20+
name = "${pypi_pkg_name}"
21+
version = "0.0.1"
22+
[tool.hatch.build.targets.wheel]
23+
bypass-selection = true
24+
EOF
25+
python -m build --wheel pkg_placeholder
26+
mv pkg_placeholder/dist/* dist/
27+
fi
28+
fi
29+
done

0 commit comments

Comments
 (0)