Skip to content

Commit

Permalink
Create build_python_package.yml (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayureshagashe2105 authored Sep 29, 2023
1 parent 32f50ac commit d1b7a57
Showing 1 changed file with 104 additions and 0 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/build_python_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Publish Python 🐍 distribution 📦 to PyPI and run tests


on:
workflow_dispatch:

release:
types: [created]


jobs:
build:
if: github.repository == 'CaffeineCrew/Techdocs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install package-dependencies
- run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: build package
- run: |
python python setup.py sdist bdist_wheel
- name: Store dist as an artifact
- uses: actions/upload-artifact@v3
- with:
name: python-package
path: dist/


publish_package_to_testpypi:
if: github.repository == 'CaffeineCrew/Techdocs'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install twine
- name: Publish 📦 to testpypi
env:
TESETPYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
TESTPYPI_CLI: ${{ secrets.PYPI_PASSWORD }}
- uses: actions/download-artifact@v3
- with:
name: python-package
- run: |
twine upload -r testpypi dist/*
run_tests:
needs: [build, publish_package_to_testpypi]
runs-on: ubuntu-latest
steps:
- working-directory: /techdocs
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --no-cache-dir --index-url https://test.pypi.org/simple/ --extra-index-url=https://pypi.org/simple/ techdocs
- name: Test testpypi package
run: |
techdocs run tests
publish_package_to_pypi:
needs: [build, publish_package_to_testpypi, run_tests]
if: github.repository == 'CaffeineCrew/Techdocs'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Publish 📦 to pypi
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_CLI: ${{ secrets.PYPI_PASSWORD }}
- uses: actions/download-artifact@v3
- with:
name: python-package
- run: |
twine upload dist/*
pip install techdocs --upgrade

0 comments on commit d1b7a57

Please sign in to comment.