Skip to content

Commit 65b86dd

Browse files
authored
CI: Add PyPi publish workflow (#44)
1 parent 529ed70 commit 65b86dd

File tree

5 files changed

+64
-31
lines changed

5 files changed

+64
-31
lines changed

.github/workflows/pypi_publish.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish to PyPi
2+
3+
on:
4+
push:
5+
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
- uses: hynek/build-and-inspect-python-package@v2
16+
17+
publish:
18+
name: Publish to PyPI
19+
runs-on: ubuntu-latest
20+
needs: [build]
21+
permissions:
22+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
23+
contents: write # Needed to upload artifacts to the release
24+
environment:
25+
name: PyPi
26+
url: https://pypi.org/p/airbyte
27+
if: startsWith(github.ref, 'refs/tags/')
28+
steps:
29+
- uses: actions/download-artifact@v4
30+
with:
31+
name: Packages
32+
path: dist
33+
- name: Upload wheel to release
34+
uses: svenstaro/upload-release-action@v2
35+
with:
36+
repo_token: ${{ secrets.GITHUB_TOKEN }}
37+
file: dist/*.whl
38+
tag: ${{ github.ref }}
39+
overwrite: true
40+
file_glob: true
41+
42+
- name: Publish
43+
uses: pypa/gh-action-pypi-publish@v1.8.11

CONTRIBUTING.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@ Documentation pages will be generated in the `docs/generated` folder. The `test_
2525

2626
## Release
2727

28-
- In your PR:
29-
- Bump the version in `pyproject.toml`
30-
- Add a changelog entry to the table below
31-
- Once the PR is merged, go to Github and trigger the `Publish PyAirbyte Manually` workflow. This will publish the new version to PyPI.
28+
Releases are published automatically to PyPi in response to a "published" event on a GitHub Release Tag.
29+
30+
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.
31+
32+
> **Warning**
33+
>
34+
> Be careful - "Cmd+Enter" will not 'save' but will instead 'publish'. (If you want to save a draft, use the mouse. 😅)
35+
36+
> **Note**
37+
>
38+
> 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.
3239
3340
## Versioning
3441

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PyAirbyte
22

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

55
## Secrets Management
66

pyproject.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
[tool.poetry]
22
name = "airbyte"
33
description = "PyAirbyte"
4-
version = "0.1.0"
54
authors = ["Airbyte <contact@airbyte.io>"]
65
readme = "README.md"
76
packages = [{include = "airbyte"}]
87

8+
# This project uses dynamic versioning
9+
# https://github.com/mtkennerly/poetry-dynamic-versioning
10+
version = "0.0.0"
11+
12+
[tool.poetry-dynamic-versioning]
13+
enable = true
14+
915
[tool.poetry.dependencies]
1016
python = "^3.9"
1117

@@ -51,8 +57,8 @@ airbyte-source-faker = "^6.0.0"
5157
tomli = "^2.0"
5258

5359
[build-system]
54-
requires = ["poetry-core"]
55-
build-backend = "poetry.core.masonry.api"
60+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
61+
build-backend = "poetry_dynamic_versioning.backend"
5662

5763
[tool.pytest.ini_options]
5864
markers = [

tests/docs_tests/test_validate_changelog.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)