|
| 1 | +name: Publish to PyPI [Production] |
| 2 | + |
| 3 | +# Allow manual triggering of the workflow |
| 4 | +on: |
| 5 | + workflow_dispatch: # This enables manual triggering of the workflow |
| 6 | + inputs: |
| 7 | + version: # The version input that will be provided manually when the workflow is triggered |
| 8 | + description: 'Specify the version to release (e.g., 4.0.0, 4.0.0.b0)' |
| 9 | + required: true |
| 10 | + default: '4.0.0.b0' # Set a default version value |
| 11 | + |
| 12 | +jobs: |
| 13 | + publish: |
| 14 | + name: Publish |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + #---------------------------------------------- |
| 19 | + # Step 1: Check out the repository code |
| 20 | + #---------------------------------------------- |
| 21 | + - name: Check out repository |
| 22 | + uses: actions/checkout@v2 # Check out the repository to access the code |
| 23 | + |
| 24 | + #---------------------------------------------- |
| 25 | + # Step 2: Set up Python environment |
| 26 | + #---------------------------------------------- |
| 27 | + - name: Set up python |
| 28 | + id: setup-python |
| 29 | + uses: actions/setup-python@v2 |
| 30 | + with: |
| 31 | + python-version: 3.9 # Specify the Python version to be used |
| 32 | + |
| 33 | + #---------------------------------------------- |
| 34 | + # Step 3: Install and configure Poetry |
| 35 | + #---------------------------------------------- |
| 36 | + - name: Install Poetry |
| 37 | + uses: snok/install-poetry@v1 # Install Poetry, the Python package manager |
| 38 | + with: |
| 39 | + virtualenvs-create: true |
| 40 | + virtualenvs-in-project: true |
| 41 | + installer-parallel: true |
| 42 | + |
| 43 | +# #---------------------------------------------- |
| 44 | +# # Step 4: Load cached virtual environment (if available) |
| 45 | +# #---------------------------------------------- |
| 46 | +# - name: Load cached venv |
| 47 | +# id: cached-poetry-dependencies |
| 48 | +# uses: actions/cache@v2 |
| 49 | +# with: |
| 50 | +# path: .venv # Path to the virtual environment |
| 51 | +# key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }} |
| 52 | +# # Cache key is generated based on OS, Python version, repo name, and the `poetry.lock` file hash |
| 53 | + |
| 54 | +# #---------------------------------------------- |
| 55 | +# # Step 5: Install dependencies if the cache is not found |
| 56 | +# #---------------------------------------------- |
| 57 | +# - name: Install dependencies |
| 58 | +# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' # Only run if the cache was not hit |
| 59 | +# run: poetry install --no-interaction --no-root # Install dependencies without interaction |
| 60 | + |
| 61 | +# #---------------------------------------------- |
| 62 | +# # Step 6: Update the version to the manually provided version |
| 63 | +# #---------------------------------------------- |
| 64 | +# - name: Update pyproject.toml with the specified version |
| 65 | +# run: poetry version ${{ github.event.inputs.version }} # Use the version provided by the user input |
| 66 | + |
| 67 | + #---------------------------------------------- |
| 68 | + # Step 7: Build and publish the first package to PyPI |
| 69 | + #---------------------------------------------- |
| 70 | + - name: Build and publish databricks sql connector to PyPI |
| 71 | + working-directory: ./databricks_sql_connector |
| 72 | + uses: JRubics/[email protected] # Use the poetry-publish action to handle publishing |
| 73 | + with: |
| 74 | + pypi_token: ${{ secrets.PROD_PYPI_TOKEN }} # The PyPI token for authentication, stored in GitHub Secrets |
| 75 | + |
| 76 | + #---------------------------------------------- |
| 77 | + # Step 7: Build and publish the second package to PyPI |
| 78 | + #---------------------------------------------- |
| 79 | + |
| 80 | + - name: Build and publish databricks sql connector core to PyPI |
| 81 | + working-directory: ./databricks_sql_connector_core |
| 82 | + uses: JRubics/[email protected] # Use the poetry-publish action to handle publishing |
| 83 | + with: |
| 84 | + pypi_token: ${{ secrets.PROD_PYPI_TOKEN }} # The PyPI token for authentication, stored in GitHub Secrets |
0 commit comments