From 0c3cdd9ebe005ae789f10c31d935eb79b7412f8f Mon Sep 17 00:00:00 2001 From: DimuthuMadushan Date: Thu, 9 Nov 2023 10:16:35 +0530 Subject: [PATCH 1/2] [Automated] Update the native jar versions --- copybook-tool/Ballerina.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/copybook-tool/Ballerina.toml b/copybook-tool/Ballerina.toml index ccdcf94..85f22d7 100644 --- a/copybook-tool/Ballerina.toml +++ b/copybook-tool/Ballerina.toml @@ -3,6 +3,6 @@ org = "ballerina" name = "copybook" version = "0.1.0" authors = ["Ballerina"] -keywords = ["copybook"] +keywords = ["copybook", "copybook tool"] license = ["Apache-2.0"] distribution = "2201.8.0" From 8aed05a3d624c05b25d910c52af632a1ff5efe1c Mon Sep 17 00:00:00 2001 From: DimuthuMadushan Date: Thu, 9 Nov 2023 10:21:03 +0530 Subject: [PATCH 2/2] Add dev and cetral publish workflow --- .github/workflows/publish-release.yml | 34 +++++++++++++++++-- build-config/resources/package/Ballerina.toml | 2 +- .../copybook/generator/CodeGenerator.java | 2 +- .../tools/copybook/cmd/CopybookCmdTest.java | 6 ++-- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 3901cff..3304979 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -1,4 +1,4 @@ -name: Release +name: Central Publish on: workflow_dispatch: @@ -43,12 +43,42 @@ jobs: env: JAVA_HOME: /usr/lib/jvm/default-jvm - - name: Ballerina Push + - name: Ballerina Central Push + if: ${{ inputs.environment == 'CENTRAL' }} uses: ballerina-platform/ballerina-action/@2201.8.0 with: args: push env: WORKING_DIR: ./copybook-tool + BALLERINA_DEV_CENTRAL: false + BALLERINA_STAGE_CENTRAL: false + packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} + packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} + JAVA_HOME: /usr/lib/jvm/default-jvm + BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} + + - name: Ballerina Central Stage Push + if: ${{ inputs.environment == 'STAGE CENTRAL' }} + uses: ballerina-platform/ballerina-action/@2201.8.0 + with: + args: push + env: + WORKING_DIR: ./copybook-tool + BALLERINA_DEV_CENTRAL: false + BALLERINA_STAGE_CENTRAL: true + packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} + packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} + JAVA_HOME: /usr/lib/jvm/default-jvm + BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }} + + - name: Ballerina Central Dev Push + if: ${{ inputs.environment == 'DEV CENTRAL' }} + uses: ballerina-platform/ballerina-action/@2201.8.0 + with: + args: push + env: + WORKING_DIR: ./copybook-tool + BALLERINA_DEV_CENTRAL: true BALLERINA_STAGE_CENTRAL: false packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} diff --git a/build-config/resources/package/Ballerina.toml b/build-config/resources/package/Ballerina.toml index 3d78f1c..75ee1cf 100644 --- a/build-config/resources/package/Ballerina.toml +++ b/build-config/resources/package/Ballerina.toml @@ -3,6 +3,6 @@ org = "ballerina" name = "copybook" version = "@toml.version@" authors = ["Ballerina"] -keywords = ["copybook"] +keywords = ["copybook", "copybook tool"] license = ["Apache-2.0"] distribution = "2201.8.0" diff --git a/copybook-cli/src/main/java/io/ballerina/tools/copybook/generator/CodeGenerator.java b/copybook-cli/src/main/java/io/ballerina/tools/copybook/generator/CodeGenerator.java index 90102bb..7319029 100644 --- a/copybook-cli/src/main/java/io/ballerina/tools/copybook/generator/CodeGenerator.java +++ b/copybook-cli/src/main/java/io/ballerina/tools/copybook/generator/CodeGenerator.java @@ -58,7 +58,7 @@ public static void generate(Path cbFilePath, Path targetOutputPath, PrintStream String fileName = getFileName(cbFilePath.toString()); String resolvedFileName = resolveSchemaFileName(targetOutputPath, fileName); writeFile(targetOutputPath.resolve(resolvedFileName), src); - outStream.println("Ballerina record types generated successfully and copied to :"); + outStream.println("Ballerina record types are generated successfully and copied to :"); outStream.println("-- " + resolvedFileName); } } diff --git a/copybook-cli/src/test/java/io/ballerina/tools/copybook/cmd/CopybookCmdTest.java b/copybook-cli/src/test/java/io/ballerina/tools/copybook/cmd/CopybookCmdTest.java index 4194e61..23c67e2 100644 --- a/copybook-cli/src/test/java/io/ballerina/tools/copybook/cmd/CopybookCmdTest.java +++ b/copybook-cli/src/test/java/io/ballerina/tools/copybook/cmd/CopybookCmdTest.java @@ -62,7 +62,7 @@ public void testCopybookTypeGeneration() throws IOException { String generatedSchema = readContentWithFormat(this.tmpDir.resolve("copybook.bal")); Assert.assertEquals(expectedSchema, generatedSchema); String output = readOutput(true); - Assert.assertTrue(output.contains("Ballerina record types generated successfully and copied to")); + Assert.assertTrue(output.contains("Ballerina record types are generated successfully and copied to")); } @Test(description = "Test copybook type generation with multiple root levels") @@ -78,7 +78,7 @@ public void testTypeGenerationWithMultipleRootLevels() throws IOException { String generatedSchema = readContentWithFormat(this.tmpDir.resolve("hospital.bal")); Assert.assertEquals(expectedSchema, generatedSchema); String output = readOutput(true); - Assert.assertTrue(output.contains("Ballerina record types generated successfully and copied to")); + Assert.assertTrue(output.contains("Ballerina record types are generated successfully and copied to")); } @Test(description = "Test copybook type generation with multiple root levels") @@ -94,7 +94,7 @@ public void testTypeGenerationWithRedefines() throws IOException { String generatedSchema = readContentWithFormat(this.tmpDir.resolve("redefine.bal")); Assert.assertEquals(expectedSchema, generatedSchema); String output = readOutput(true); - Assert.assertTrue(output.contains("Ballerina record types generated successfully and copied to")); + Assert.assertTrue(output.contains("Ballerina record types are generated successfully and copied to")); } @Test(description = "Test copybook type generation with multiple root levels")