Skip to content

Build Placeholder PyPI Packages #362

Build Placeholder PyPI Packages

Build Placeholder PyPI Packages #362

# This workflow claims package names on PyPI for our integrations by publishing empty packages.
# The working packages can be found here:
# https://dd-integrations-core-wheels-build-stable.datadoghq.com/targets/simple/index.html
# This is a work-around until PyPI adds support for namespaces and we claim an entire namespace for Datadog.
name: Build Placeholder PyPI Packages
on:
workflow_dispatch:
schedule:
# At 3AM UTC
# Running this every night strikes a good balance between claiming names fast without spamming PyPI with requests.
- cron: "0 3 * * *"
defaults:
run:
shell: bash
jobs:
python-artifacts:
name: Build wheel
runs-on: ubuntu-latest
environment: typo-squatting-release
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python 3.11
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: 3.11
- name: Install Build Deps
run: pip install -U build[virtualenv] hatchling
- name: Build Packages
run: |
bash .github/workflows/scripts/build_placeholders.sh
- name: Push Python artifacts to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
# We don't mind invalid metadata, we only want to claim the package name.
verify-metadata: false
verbose: true
# Only uploading the missing wheels makes this job idempotent and reduces its complexity.
skip-existing: true
user: __token__
password: ${{ secrets.PYPI_TOKEN }}