From cd2bfde323d00030bdbb76e803e148e27d3937f2 Mon Sep 17 00:00:00 2001 From: Saianeesh Keshav Haridas Date: Fri, 10 Nov 2023 16:09:22 -0500 Subject: [PATCH] ci: automatic pypi releases --- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 42 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 0000000..951bd70 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Publish Python distribution to PyPI + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish Python distribution to PyPI + if: startsWith(github.ref, 'refs/tags/') + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/megham/ + permissions: + id-token: write + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 diff --git a/.gitignore b/.gitignore index 8961702..e087189 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ megham.egg-info __pycache__ +dist