From e8823de045a5206a5ebc7d8f08ed3013b104f039 Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 16 Jul 2024 10:08:07 +0200 Subject: [PATCH] feat: add CI/CD workflow for publishing Python package Introduced a GitHub Actions workflow to automate the CI/CD process for publishing Python packages to PyPI. The workflow triggers on push tags and provides tasks for checking out code, installing dependencies, and uploading the package to PyPI using twine. This automation aims to streamline the release process and ensure consistency in package deployment. --- .forgejo/workflows/release.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .forgejo/workflows/release.yml diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml new file mode 100644 index 0000000..a344b2d --- /dev/null +++ b/.forgejo/workflows/release.yml @@ -0,0 +1,32 @@ +name: Python Package CI/CD + +on: + workflow_dispatch: + push: + tags: + - "*" + +jobs: + publish: + name: Publish to PyPI + container: + image: node:20-bookworm + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + apt update + apt install -y python3 python3-venv + + - name: Publish to PyPI + run: | + python3 -m venv venv + . ./venv/bin/activate + pip install -U twine build + python -m build . + python -m twine upload --username __token__ --password ${PYPI_TOKEN} dist/* + env: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}