Build and Publish Python Package #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will upload a Python Package to PyPI when a release is created | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries | |
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| name: Upload Python Package | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-n-publish: | |
| name: Build and publish Python 🐍 distribution 📦 to PyPI | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: libs/oci # Set default for all steps | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/langchain-oci | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Build distribution 📦 | |
| run: | | |
| pip install build | |
| python -m build | |
| - name: Validate | |
| run: | | |
| pip install dist/*.whl | |
| python -c "import langchain-oci;" | |
| ## To run publish to test PyPI a secret with token needs to be added, | |
| ## this one GH_ADS_TESTPYPI_TOKEN - removed after initial test. | |
| ## Project name also needed to be updated in pyproject.toml - name = "test_oracle_ads" in [project] section | |
| ## regular name is occupied by former developer and can't be used for testing | |
| # - name: Publish distribution 📦 to Test PyPI | |
| # env: | |
| # TWINE_USERNAME: __token__ | |
| # TWINE_PASSWORD: ${{ secrets.GH_ADS_TESTPYPI_TOKEN }} | |
| # run: | | |
| # pip install twine | |
| # twine upload -r testpypi dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD | |
| - name: Publish distribution 📦 to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.GH_LC_OCI_PYPI_TOKEN }} | |
| run: | | |
| pip install twine | |
| twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD |