Skip to content

Commit

Permalink
Added manual publish
Browse files Browse the repository at this point in the history
  • Loading branch information
jprakash-db committed Oct 8, 2024
1 parent af47301 commit 64b2818
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 4 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/publish-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Publish to PyPI [Production]

# Allow manual triggering of the workflow
on:
workflow_dispatch: # This enables manual triggering of the workflow
inputs:
version: # The version input that will be provided manually when the workflow is triggered
description: 'Specify the version to release (e.g., 4.0.0, 4.0.0.b0)'
required: true
default: '4.0.0.b0' # Set a default version value

jobs:
publish:
name: Publish
runs-on: ubuntu-latest

steps:
#----------------------------------------------
# Step 1: Check out the repository code
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2 # Check out the repository to access the code

#----------------------------------------------
# Step 2: Set up Python environment
#----------------------------------------------
- name: Set up python
id: setup-python
uses: actions/setup-python@v2
with:
python-version: 3.9 # Specify the Python version to be used

#----------------------------------------------
# Step 3: Install and configure Poetry
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1 # Install Poetry, the Python package manager
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

# #----------------------------------------------
# # Step 4: Load cached virtual environment (if available)
# #----------------------------------------------
# - name: Load cached venv
# id: cached-poetry-dependencies
# uses: actions/cache@v2
# with:
# path: .venv # Path to the virtual environment
# key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
# # Cache key is generated based on OS, Python version, repo name, and the `poetry.lock` file hash

# #----------------------------------------------
# # Step 5: Install dependencies if the cache is not found
# #----------------------------------------------
# - name: Install dependencies
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' # Only run if the cache was not hit
# run: poetry install --no-interaction --no-root # Install dependencies without interaction

# #----------------------------------------------
# # Step 6: Update the version to the manually provided version
# #----------------------------------------------
# - name: Update pyproject.toml with the specified version
# run: poetry version ${{ github.event.inputs.version }} # Use the version provided by the user input

#----------------------------------------------
# Step 7: Build and publish the first package to PyPI
#----------------------------------------------
- name: Build and publish databricks sql connector to PyPI
working-directory: ./databricks_sql_connector
uses: JRubics/[email protected] # Use the poetry-publish action to handle publishing
with:
pypi_token: ${{ secrets.PROD_PYPI_TOKEN }} # The PyPI token for authentication, stored in GitHub Secrets

#----------------------------------------------
# Step 7: Build and publish the second package to PyPI
#----------------------------------------------

- name: Build and publish databricks sql connector core to PyPI
working-directory: ./databricks_sql_connector_core
uses: JRubics/[email protected] # Use the poetry-publish action to handle publishing
with:
pypi_token: ${{ secrets.PROD_PYPI_TOKEN }} # The PyPI token for authentication, stored in GitHub Secrets
6 changes: 3 additions & 3 deletions databricks_sql_connector/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tool.poetry]
name = "databricks-sql-connector"
version = "3.5.0"
version = "4.0.0.b0"
description = "Databricks SQL Connector for Python"
authors = ["Databricks <[email protected]>"]
license = "Apache-2.0"


[tool.poetry.dependencies]
databricks_sql_connector_core = { version = ">=1.0.0", extras=["all"]}
databricks_sqlalchemy = { version = ">=1.0.0", optional = true }
databricks_sql_connector_core = { version = ">=4.0.0", extras=["all"]}
databricks_sqlalchemy = { version = ">=4.0.0", optional = true }

[tool.poetry.extras]
databricks_sqlalchemy = ["databricks_sqlalchemy"]
Expand Down
2 changes: 1 addition & 1 deletion databricks_sql_connector_core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "databricks-sql-connector-core"
version = "1.0.0"
version = "4.0.0.b0"
description = "Databricks SQL Connector core for Python"
authors = ["Databricks <[email protected]>"]
packages = [{ include = "databricks", from = "src" }]
Expand Down

0 comments on commit 64b2818

Please sign in to comment.