Skip to content

Commit

Permalink
gg
Browse files Browse the repository at this point in the history
  • Loading branch information
upayanmazumder committed Nov 28, 2024
1 parent 89db9de commit 4e4a507
Showing 1 changed file with 15 additions and 27 deletions.
42 changes: 15 additions & 27 deletions .github/workflows/cli-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: CLI Docker Image
name: Publish to PyPI

on:
release:
types: [published]

permissions:
contents: read
packages: write
push:
branches:
- main
workflow_dispatch:

jobs:
publish:
Expand All @@ -20,31 +18,21 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
python-version: 3.9

- name: Install dependencies
- name: Install build dependencies
working-directory: CLI
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build the package
run: |
cd CLI
python -m build --outdir dist
- name: Verify dist directory contents
run: |
cd $GITHUB_WORKSPACE
dist_dir=$(find . -type d -name dist)
if [ -z "$(ls -A $dist_dir)" ]; then
echo "Error: dist directory is empty."
exit 1
else
echo "dist directory contains:"
ls -R $dist_dir
fi
working-directory: CLI
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
working-directory: CLI
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*

0 comments on commit 4e4a507

Please sign in to comment.