Skip to content

Commit

Permalink
Merge pull request #10 from DimuthuMadushan/workflow
Browse files Browse the repository at this point in the history
Add Stage and Dev Central Publish Workflow
  • Loading branch information
DimuthuMadushan authored Nov 9, 2023
2 parents 0079842 + 8aed05a commit ddec308
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
34 changes: 32 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: Central Publish

on:
workflow_dispatch:
Expand Down Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion build-config/resources/package/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion copybook-tool/Ballerina.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit ddec308

Please sign in to comment.