diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index d55f212f9..d7ee9615b 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -29,3 +29,7 @@ jobs: run: ./gradlew :dagger-core:minimalAndShadowPublish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Publish Zip Package of dagger-py-functions + run: ./gradlew publishPyZipPublicationToGitHubPackagesRepository + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index 0af27232b..58272b4f1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,25 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + maven { + url "https://plugins.gradle.org/m2/" + } + } + +} + +plugins { + id 'maven-publish' +} + ext { flinkVersion = System.getenv('flinkVersion') ?: '1.14.3' } +def pyZipVersion = rootProject.file('version.txt').text.trim() +group 'io.odpf' + subprojects { repositories { mavenLocal() @@ -15,10 +33,37 @@ subprojects { apply plugin: 'idea' apply plugin: 'checkstyle' - group 'io.odpf' - checkstyle { toolVersion '7.6.1' configFile rootProject.file("config/checkstyle/checkstyle.xml") } +} + +task makePyZip(type: Zip) { + from fileTree(dir: 'dagger-py-functions') + include '**/*' + archiveName "dagger-py-functions.zip" + destinationDir file("$rootDir/") +} + +publishing { + publications { + pyZip(MavenPublication) { + artifact source: makePyZip, extension: 'zip' + groupId group + artifactId 'dagger-py-functions' + version pyZipVersion + } + } + + repositories { + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/odpf/dagger" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } } \ No newline at end of file diff --git a/dagger-py-functions/README.md b/dagger-py-functions/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/dagger-py-functions/requirements.txt b/dagger-py-functions/requirements.txt new file mode 100644 index 000000000..e69de29bb diff --git a/dagger-py-functions/udfs/scalar/sample_udf.py b/dagger-py-functions/udfs/scalar/sample_udf.py new file mode 100644 index 000000000..786ec1eda --- /dev/null +++ b/dagger-py-functions/udfs/scalar/sample_udf.py @@ -0,0 +1,9 @@ +from pyflink.table import ScalarFunction, DataTypes +from pyflink.table.udf import udf + +class SampleUdf(ScalarFunction): + + def eval(self, text: str): + return text + "_added_text" + +sample_udf = udf(SampleUdf(), result_type=DataTypes.STRING()) \ No newline at end of file