Skip to content

Commit 8bdfd8b

Browse files
Joe Reuteralafanechere
Joe Reuter
andauthored
airbyte-lib: Add publish action (#34486)
Co-authored-by: alafanechere <[email protected]>
1 parent 3feb04c commit 8bdfd8b

File tree

4 files changed

+79
-3
lines changed

4 files changed

+79
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish AirbyteLib Manually
2+
on: workflow_dispatch
3+
4+
concurrency:
5+
group: publish-airbyte-lib
6+
cancel-in-progress: false
7+
8+
jobs:
9+
get_ci_runner:
10+
runs-on: ubuntu-latest
11+
name: Get CI runner
12+
steps:
13+
- name: Checkout Airbyte
14+
uses: actions/checkout@v3
15+
with:
16+
ref: ${{ github.head_ref }}
17+
token: ${{ secrets.GH_PAT_APPROVINGTON_OCTAVIA }}
18+
fetch-depth: 1
19+
- name: Get CI runner
20+
id: get_ci_runner
21+
uses: ./.github/actions/airbyte-ci-requirements
22+
with:
23+
runner_type: "publish"
24+
runner_size: "large"
25+
# Getting ci requirements for connectors publish command as there is no special one for poetry publish
26+
airbyte_ci_command: "connectors publish"
27+
github_token: ${{ secrets.GH_PAT_APPROVINGTON_OCTAVIA }}
28+
sentry_dsn: ${{ secrets.SENTRY_AIRBYTE_CI_DSN }}
29+
outputs:
30+
runner_name: ${{ steps.get_ci_runner.outputs.runner_name }}
31+
publish_connectors:
32+
name: Publish airbyte-lib
33+
needs: get_ci_runner
34+
runs-on: ${{ needs.get_ci_runner.outputs.runner_name }}
35+
steps:
36+
- name: Checkout Airbyte
37+
uses: actions/checkout@v3
38+
- name: Publish
39+
id: publish-airbyte-lib
40+
uses: ./.github/actions/run-dagger-pipeline
41+
with:
42+
context: "manual"
43+
dagger_cloud_token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
44+
docker_hub_password: ${{ secrets.DOCKER_HUB_PASSWORD }}
45+
docker_hub_username: ${{ secrets.DOCKER_HUB_USERNAME }}
46+
gcp_gsm_credentials: ${{ secrets.GCP_GSM_CREDENTIALS }}
47+
gcs_credentials: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }}
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
metadata_service_gcs_credentials: ${{ secrets.METADATA_SERVICE_PROD_GCS_CREDENTIALS }}
50+
sentry_dsn: ${{ secrets.SENTRY_AIRBYTE_CI_DSN }}
51+
slack_webhook_url: ${{ secrets.PUBLISH_ON_MERGE_SLACK_WEBHOOK }}
52+
spec_cache_gcs_credentials: ${{ secrets.SPEC_CACHE_SERVICE_ACCOUNT_KEY_PUBLISH }}
53+
s3_build_cache_access_key_id: ${{ secrets.SELF_RUNNER_AWS_ACCESS_KEY_ID }}
54+
s3_build_cache_secret_key: ${{ secrets.SELF_RUNNER_AWS_SECRET_ACCESS_KEY }}
55+
tailscale_auth_key: ${{ secrets.TAILSCALE_AUTH_KEY }}
56+
subcommand: 'poetry --package-path=airbyte-lib publish --registry-url="https://test.pypi.org/legacy/"'
57+
python_registry_token: ${{ secrets.PYPI_TOKEN }}

airbyte-lib/README.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ airbyte-lib is a library that allows to run Airbyte syncs embedded into any Pyth
99
* For examples, check out the `examples` folder. They can be run via `poetry run python examples/<example file>`
1010
* Unit tests and type checks can be run via `poetry run pytest`
1111

12+
## Release
13+
14+
* In your PR:
15+
* Bump the version in `pyproject.toml`
16+
* Add a changelog entry to the table below
17+
* Once the PR is merged, go to Github and trigger the `Publish AirbyteLib Manually` workflow. This will publish the new version to PyPI.
18+
19+
### Versioning
20+
21+
Versioning follows [Semantic Versioning](https://semver.org/). For new features, bump the minor version. For bug fixes, bump the patch version. For pre-releases, append `dev.N` to the version. For example, `0.1.0dev.1` is the first pre-release of the `0.1.0` version.
22+
1223
## Documentation
1324

1425
Regular documentation lives in the `/docs` folder. Based on the doc strings of public methods, we generate API documentation using [pdoc](https://pdoc.dev). To generate the documentation, run `poetry run generate-docs`. The documentation will be generated in the `docs/generate` folder. This needs to be done manually when changing the public interface of the library.
@@ -25,4 +36,10 @@ airbyte-lib-validate-source —connector-dir . -—sample-config secrets/config.
2536

2637
The script will install the python package in the provided directory, and run the connector against the provided config. The config should be a valid JSON file, with the same structure as the one that would be provided to the connector in Airbyte. The script will exit with a non-zero exit code if the connector fails to run.
2738

28-
For a more lightweight check, the `--validate-install-only` flag can be used. This will only check that the connector can be installed and returns a spec, no sample config required.
39+
For a more lightweight check, the `--validate-install-only` flag can be used. This will only check that the connector can be installed and returns a spec, no sample config required.
40+
41+
## Changelog
42+
43+
| Version | PR | Description |
44+
| ----------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
45+
| 0.1.0dev.2 | [#34111](https://github.com/airbytehq/airbyte/pull/34111) | Initial publish - add publish workflow |

airbyte-lib/airbyte_lib/validate.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,7 @@ def validate(connector_dir: str, sample_config: str, *, validate_install_only: b
143143
install_only_test(connector_name)
144144
else:
145145
if not sample_config:
146-
raise Exception("sample_config is required when -validate-install-only is not set")
146+
raise exc.AirbyteLibInputError(
147+
input_value="--sample-config is required without --validate-install-only set"
148+
)
147149
full_tests(connector_name, sample_config)

airbyte-lib/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "airbyte-lib"
33
description = "AirbyteLib"
4-
version = "0.1.0"
4+
version = "0.1.0dev.2"
55
authors = ["Airbyte <[email protected]>"]
66
readme = "README.md"
77
packages = [{include = "airbyte_lib"}]

0 commit comments

Comments
 (0)