Skip to content

Commit

Permalink
CI: Add PyPi publish workflow (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers authored Feb 17, 2024
1 parent 529ed70 commit 65b86dd
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 31 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publish to PyPi

on:
push:

workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2

publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build]
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # Needed to upload artifacts to the release
environment:
name: PyPi
url: https://pypi.org/p/airbyte
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- name: Upload wheel to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*.whl
tag: ${{ github.ref }}
overwrite: true
file_glob: true

- name: Publish
uses: pypa/[email protected]
15 changes: 11 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@ Documentation pages will be generated in the `docs/generated` folder. The `test_

## Release

- In your PR:
- Bump the version in `pyproject.toml`
- Add a changelog entry to the table below
- Once the PR is merged, go to Github and trigger the `Publish PyAirbyte Manually` workflow. This will publish the new version to PyPI.
Releases are published automatically to PyPi in response to a "published" event on a GitHub Release Tag.

To publish to PyPi, simply [create a GitHub Release](https://github.com/airbytehq/PyAirbyte/releases/new) with the correct version. Once you publish the release on GitHub it will automatically trigger a PyPi publish workflow in GitHub actions.

> **Warning**
>
> Be careful - "Cmd+Enter" will not 'save' but will instead 'publish'. (If you want to save a draft, use the mouse. 😅)
> **Note**
>
> There is no version to bump. Version is calculated during build and publish, using the [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning) plugin.
## Versioning

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PyAirbyte

PyAirbyte is a library that allows to run Airbyte syncs embedded into any Python application, without requiring connectivity to a hosted Airbyte instance.
PyAirbyte brings the power of Airbyte to every Python developer.

## Secrets Management

Expand Down
12 changes: 9 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
[tool.poetry]
name = "airbyte"
description = "PyAirbyte"
version = "0.1.0"
authors = ["Airbyte <[email protected]>"]
readme = "README.md"
packages = [{include = "airbyte"}]

# This project uses dynamic versioning
# https://github.com/mtkennerly/poetry-dynamic-versioning
version = "0.0.0"

[tool.poetry-dynamic-versioning]
enable = true

[tool.poetry.dependencies]
python = "^3.9"

Expand Down Expand Up @@ -51,8 +57,8 @@ airbyte-source-faker = "^6.0.0"
tomli = "^2.0"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"

[tool.pytest.ini_options]
markers = [
Expand Down
23 changes: 0 additions & 23 deletions tests/docs_tests/test_validate_changelog.py

This file was deleted.

0 comments on commit 65b86dd

Please sign in to comment.