Skip to content

Merge pull request #49 from niveathika/main #17

Merge pull request #49 from niveathika/main

Merge pull request #49 from niveathika/main #17

name: Build
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
on:
push:
branches:
- main
workflow_dispatch:
jobs:
ubuntu-build:
name: Build
runs-on: ubuntu-latest
concurrency:
group: ${{ github.head_ref }}-ubuntu-build
cancel-in-progress: true
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: latest
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7
- 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
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Set ENV Variables
run: |
echo -e '${{ toJson(secrets) }}' | jq -r 'to_entries[] | .key + "=" + .value' >> $GITHUB_ENV
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew build
- name: Generate Codecov Report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}