From 540b33a2c377f571e8194868d87d66be390f6321 Mon Sep 17 00:00:00 2001 From: Tatiana Al-Chueyr Date: Thu, 17 Oct 2024 10:38:38 +0100 Subject: [PATCH] Configure GitHub to automate publishing DAG Factory in PyPI (#255) Automate the release process using GitHub actions so we can consistently make release 0.20.0 and future releases. As part of this change, I've already generated a PyPI upload token and configured the environment variable `PYPI_TOKEN` as a GitHub secret. --- .github/workflows/release.yml | 20 ++++++++++++++++++++ pyproject.toml | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..fee31d41 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ + Publish-Package: + if: github.event_name == 'release' + name: Build and publish Python 🐍 distributions 📦 to PyPI + needs: + - Static-Check + - Run-Unit-Tests + - Code-Coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + architecture: 'x64' + - run: pip3 install hatch + - run: hatch build + - run: hatch publish + env: + HATCH_INDEX_USER: __token__ + HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 0cc61a2b..5ef3f331 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,12 +82,18 @@ Source = "https://github.com/astronomer/dag-factory" [tool.hatch.version] path = "dagfactory/__init__.py" +[tool.hatch.build] +sources = ["."] + [tool.hatch.build.targets.sdist] include = ["dagfactory"] [tool.hatch.build.targets.wheel] packages = ["dagfactory"] +[tool.distutils.bdist_wheel] +universal = true + [tool.pytest.ini_options] filterwarnings = ["ignore::DeprecationWarning"] minversion = "6.0"