From a8bc4092b66a94897a67b5144bef8c6c6d6aedad Mon Sep 17 00:00:00 2001 From: Isuru Wijesiri Date: Thu, 2 Nov 2023 10:35:54 +0530 Subject: [PATCH 1/2] Add a workflow for transaction counting service release --- .../workflows/counting-service-release.yml | 49 +++++++++++++++++++ service/Ballerina.toml | 2 +- service/Cloud.toml | 5 +- 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/counting-service-release.yml diff --git a/.github/workflows/counting-service-release.yml b/.github/workflows/counting-service-release.yml new file mode 100644 index 0000000..d414090 --- /dev/null +++ b/.github/workflows/counting-service-release.yml @@ -0,0 +1,49 @@ +name: Release Transaction Counting Service +on: + workflow_dispatch: +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Cache Ballerina. + uses: actions/cache@v3 + id: cache + with: + path: "ballerina-dist/*.deb" + key: "ballerina-2201.8.0" + - name: Download Ballerina distribution. + shell: sh + run: | + mkdir -p ballerina-dist + wget 'https://dist.ballerina.io/downloads/2201.8.0/ballerina-2201.8.0-swan-lake-linux-x64.deb' -P ballerina-dist + if: steps.cache.outputs.cache-hit != 'true' + - name: Install Ballerina distribution. + shell: sh + run: "sudo dpkg -i ballerina-dist/ballerina-2201.8.0-swan-lake-linux-x64.deb" + - name: Verify Ballerina Version + shell: sh + run: "bal -v" + + - name: Checkout code + uses: actions/checkout@v4 + - name: Build ballerina service + working-directory: ./service + run: bal build + - name: Read the version from Ballerina.toml + uses: SebRollen/toml-action@v1.0.2 + id: read_toml + with: + file: 'service/Ballerina.toml' + field: 'package.version' + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Push docker Image to Docker Hub + run: | + docker push ${{ secrets.DOCKER_USERNAME }}/transaction-counting-service:latest + docker tag ${{ secrets.DOCKER_USERNAME }}/transaction-counting-service:latest ${{ secrets.DOCKER_USERNAME }}/transaction-counting-service:${{ steps.read_toml.outputs.value }} + docker push ${{ secrets.DOCKER_USERNAME }}/transaction-counting-service:${{ steps.read_toml.outputs.value }} + diff --git a/service/Ballerina.toml b/service/Ballerina.toml index 4484da3..8e76c41 100644 --- a/service/Ballerina.toml +++ b/service/Ballerina.toml @@ -6,4 +6,4 @@ distribution = "2201.7.0" [build-options] observabilityIncluded = true -cloud = "k8s" +cloud = "docker" diff --git a/service/Cloud.toml b/service/Cloud.toml index 97164a3..93fbce7 100644 --- a/service/Cloud.toml +++ b/service/Cloud.toml @@ -1,7 +1,4 @@ [container.image] repository="wso2inc" name="transaction-counting-service" -tag="v0.1.0-SNAPSHOT" - -[settings] -buildImage=false +tag="latest" From de53a1674b59e5d574112f823fd124b43c87f281 Mon Sep 17 00:00:00 2001 From: Isuru Wijesiri Date: Thu, 30 Nov 2023 08:50:41 +0530 Subject: [PATCH 2/2] Add a workflow for handler release --- .../workflows/counting-handler-release.yml | 23 +++++++++++++++++++ pom.xml | 2 +- service/Ballerina.toml | 2 +- service/pom.xml | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/counting-handler-release.yml diff --git a/.github/workflows/counting-handler-release.yml b/.github/workflows/counting-handler-release.yml new file mode 100644 index 0000000..54600d7 --- /dev/null +++ b/.github/workflows/counting-handler-release.yml @@ -0,0 +1,23 @@ +name: Release Transaction Counting Handler +on: + workflow_dispatch: +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + - name: Checkout code + uses: actions/checkout@v4 + - name: Build with Maven + working-directory: ./counter + run: mvn package --file pom.xml + - name: Release Maven package + uses: samuelmeuli/action-maven-publish@v1 + with: + directory: ./counter + nexus_username: ${{ secrets.NEXUS_USERNAME }} + nexus_password: ${{ secrets.NEXUS_PASSWORD }} diff --git a/pom.xml b/pom.xml index f1e4c11..d6cf69c 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ org.wso2.integration.transaction.counter transaction-counter pom - 0.1.0-SNAPSHOT + 0.1.0 WSO2 Integration Transaction Counter diff --git a/service/Ballerina.toml b/service/Ballerina.toml index 8e76c41..c4746bf 100644 --- a/service/Ballerina.toml +++ b/service/Ballerina.toml @@ -1,7 +1,7 @@ [package] org = "wso2" name = "TransactionCountingService" -version = "0.1.0-SNAPSHOT" +version = "0.1.0" distribution = "2201.7.0" [build-options] diff --git a/service/pom.xml b/service/pom.xml index c56aa6e..206f764 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -21,7 +21,7 @@ org.wso2.integration.transaction.counter transaction-counter - 0.1.0-SNAPSHOT + 0.1.0 transaction-count-service