Daily Build #979
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Daily Build | |
on: | |
schedule: | |
- cron: '30 18 * * *' | |
workflow_dispatch: | |
inputs: | |
ballerina_version: | |
description: 'Ballerina version' | |
required: true | |
default: '2201.9.0' | |
env: | |
BALLERINA_DISTRIBUTION_VERSION: 2201.9.0 # Update this with the latest Ballerina version | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'ballerina-platform' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.7 | |
- name: Set up Ballerina | |
if: github.event_name == 'workflow_dispatch' | |
uses: ballerina-platform/[email protected] | |
with: | |
version: ${{ github.event.inputs.ballerina_version }} | |
- name: Set up Ballerina | |
if: github.event_name == 'schedule' | |
uses: ballerina-platform/[email protected] | |
with: | |
version: ${{ env.BALLERINA_DISTRIBUTION_VERSION }} | |
- name: Change to Timestamped Version | |
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 | |
echo TIMESTAMPED_VERSION=$updatedVersion >> $GITHUB_ENV | |
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Set Docker Host env variable | |
run: echo "DOCKER_HOST=$(docker context ls --format '{{print .DockerEndpoint}}' | tr -d '\n')" >> $GITHUB_ENV | |
- name: Build with Gradle | |
env: | |
DOCKER_HOST: unix:///var/run/docker.sock | |
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }} | |
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }} | |
packagePublishRepo: ${{ github.repository }} | |
run: | | |
./gradlew clean build publish --stacktrace --scan --console=plain --no-daemon | |
./gradlew codeCoverageReport --console=plain --no-daemon | |
- name: Upload Coverage Report | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ballerina-tests/jaeger-server-tests/target/report/jaeger_server_tests/coverage-report.xml | |
- name: Notify failure | |
if: ${{ failure() }} | |
run: | | |
curl -X POST \ | |
'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \ | |
-H 'Accept: application/vnd.github.v3+json' \ | |
-H 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \ | |
--data "{ | |
\"event_type\": \"notify-build-failure\", | |
\"client_payload\": { | |
\"repoName\": \"module-ballerinax-jaeger\" | |
} | |
}" |