Skip to content

Commit

Permalink
Merge pull request #5745 from MohamedSabthar/workflow-mig
Browse files Browse the repository at this point in the history
Add publish-required flag to build-connector-template
  • Loading branch information
MohamedSabthar authored Nov 8, 2023
2 parents 6df39f1 + bcda203 commit 6d2347f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build-connector-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
required: false
type: string
default: ""
publish-required:
required: false
type: boolean
default: false


jobs:
Expand All @@ -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: |
Expand All @@ -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')
Expand Down

0 comments on commit 6d2347f

Please sign in to comment.