From bcda203d015d426730f718df129457f98c693e35 Mon Sep 17 00:00:00 2001 From: MohamedSabthar Date: Wed, 8 Nov 2023 13:41:00 +0530 Subject: [PATCH] Add publish-required flag to build-connector-template --- .../workflows/build-connector-template.yml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/build-connector-template.yml b/.github/workflows/build-connector-template.yml index 2cccb682..b73d02cc 100644 --- a/.github/workflows/build-connector-template.yml +++ b/.github/workflows/build-connector-template.yml @@ -14,6 +14,10 @@ on: required: false type: string default: "" + publish-required: + required: false + type: boolean + default: false jobs: @@ -37,6 +41,16 @@ jobs: with: distribution: 'temurin' java-version: 17.0.7 + + - name: Change to Timestamped Version + if: ${{ inputs.publish-required == true }} + run: | + startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00') + latestCommit=$(git log -n 1 --pretty=format:"%h") + VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev) + updatedVersion=$VERSION-$startTime-$latestCommit + echo $updatedVersion + sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties - name: Set ENV Variables run: | @@ -53,6 +67,15 @@ jobs: - name: Generate Codecov Report uses: codecov/codecov-action@v3 + - name: Publish Connector + if: ${{ inputs.publish-required == true }} + env: + packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} + packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} + publishUser: ${{ secrets.BALLERINA_BOT_USERNAME }} + publishPAT: ${{ secrets.BALLERINA_BOT_TOKEN }} + run: ./gradlew publish --no-daemon --scan ${{ inputs.additional-build-flags }} + # Send notification when build fails - name: Alert notifier on failure if: failure() && (github.event.action == 'check_connector_for_breaking_changes')