Skip to content

Commit

Permalink
Add a GHA workflow to push the python package to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-awala committed Feb 4, 2024
1 parent ced2686 commit 631a921
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Python Release

on:
push:
tags:
- '*'

jobs:
python-release-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up python 3.11
id: setup-python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: update the version
run: |
poetry version ${{ github.ref_name }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root --all-extras

- name: Install library
run: poetry install --no-interaction --all-extras

- name: Build release distributions
run: |
poetry build
- name: Upload dists
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- python-release-build
environment:
name: pypi
url: https://pypi.org/p/airflow-duckdb
permissions:
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 631a921

Please sign in to comment.