Skip to content

Commit

Permalink
fix: fix publish for python classes calling wrong docker script (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
erohmensing authored Jun 18, 2024
1 parent 68dc80b commit 2a92e61
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
9 changes: 7 additions & 2 deletions .github/actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,15 @@ runs:
shell: bash
run: ./gradlew publish

# python
# python - pydantic v1
- name: Generate Python Protocol Classes
shell: bash
run: protocol-models/bin/generate-python-classes-docker.sh
run: protocol-models/bin/generate-python-pydantic.sh

# python - pydantic v2
- name: Generate Python Protocol Classes
shell: bash
run: protocol-models/bin/generate-python-pydantic-v2.sh

- name: Publish Python Package
uses: mariamrf/[email protected]
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ subprojects { subproj ->
}

task('generate') {
dependsOn subprojects.collect { it.getTasksByName('generatePythonProtocolClassFiles', true) }
dependsOn subprojects.collect { it.getTasksByName('generatePythonPydanticV1ProtocolClassFiles', true) }
dependsOn subprojects.collect { it.getTasksByName('generatePythonPydanticV2ProtocolClassFiles', true) }
dependsOn subprojects.collect { it.getTasksByName('generateTypescriptProtocolClassFiles', true) }
dependsOn subprojects.collect { it.getTasksByName('generateJsonSchema2Pojo', true) }
}
Expand Down
2 changes: 1 addition & 1 deletion protocol-models/bin/generate-python-pydantic-v2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pip install -U datamodel_code_generator
rm -rf "$ROOT_DIR/$OUTPUT_DIR"/*.py
mkdir -p "$ROOT_DIR/$OUTPUT_DIR"

echo "# generated by generate-python-classes" > "$ROOT_DIR/$OUTPUT_DIR"/__init__.py
echo "# generated by generate-python-pydantic-v2" > "$ROOT_DIR/$OUTPUT_DIR"/__init__.py
echo "name = 'models'" >> "$ROOT_DIR/$OUTPUT_DIR"/__init__.py

for f in "$ROOT_DIR/$YAML_DIR"/*.yaml; do
Expand Down
2 changes: 1 addition & 1 deletion protocol-models/bin/generate-python-pydantic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pip install datamodel_code_generator==0.11.19
rm -rf "$ROOT_DIR/$OUTPUT_DIR"/*.py
mkdir -p "$ROOT_DIR/$OUTPUT_DIR"

echo "# generated by generate-python-classes" > "$ROOT_DIR/$OUTPUT_DIR"/__init__.py
echo "# generated by generate-python-pydantic.sh" > "$ROOT_DIR/$OUTPUT_DIR"/__init__.py
echo "name = 'models'" >> "$ROOT_DIR/$OUTPUT_DIR"/__init__.py

for f in "$ROOT_DIR/$YAML_DIR"/*.yaml; do
Expand Down
14 changes: 11 additions & 3 deletions protocol-models/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ jsonSchema2Pojo {

Task publishArtifactsTask = getPublishArtifactsTask("$rootProject.ext.version", project)

task generatePythonProtocolClassFiles(type: Exec) {
task generatePythonPydanticV1ClassFiles(type: Exec) {
inputs.dir 'src/main/resources/airbyte_protocol'
inputs.dir 'bin'
outputs.dir 'python/airbyte_protocol/models'
outputs.dir 'python/airbyte_protocol/airbyte_protocol/models'

commandLine 'bin/generate-python-classes-docker.sh'
commandLine 'bin/generate-python-pydantic-docker.sh'
}

task generatePythonPydanticV2ProtocolClassFiles(type: Exec) {
inputs.dir 'src/main/resources/airbyte_protocol'
inputs.dir 'bin'
outputs.dir 'python/airbyte_protocol_pdv2/airbyte_protocol/models'

commandLine 'bin/generate-python-pydantic-v2-docker.sh'
}

task generateTypescriptProtocolClassFiles(type: Exec) {
Expand Down

0 comments on commit 2a92e61

Please sign in to comment.