Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add publish-required flag to build-connector-template #5745

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading