From 6f96ec76abbe551c49fb4c6fa25b82fdd9afe939 Mon Sep 17 00:00:00 2001 From: Ahnaf Tahmid Chowdhury Date: Fri, 24 May 2024 20:07:00 +0600 Subject: [PATCH] publish --- .github/workflows/publish_release.yml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/publish_release.yml diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml new file mode 100644 index 0000000..4dbd1c0 --- /dev/null +++ b/.github/workflows/publish_release.yml @@ -0,0 +1,49 @@ +name: Publish Release + +on: + push: + tags: + - "*" + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.x + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build and package + run: | + python -m build + + - name: Publish package to PyPI + if: success() + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: | + twine upload dist/* + + - name: Create a release + id: create_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create ${{ github.ref }} \ + -t $GITHUB_REF_NAME \ + -n ${{ github.ref }} \ + -F CHANGELOG \ + ./dist/*