Skip to content

Build Dependent Standard Libraries #14

Build Dependent Standard Libraries

Build Dependent Standard Libraries #14

name: Build Dependent Standard Libraries
on:
workflow_dispatch:
inputs:
timestamped_version:
description: Module timestamped version
required: false
default: ''
target_branch:
description: Target branch of the dependent module
required: false
default: ''
ballerina_modules:
description: Dependent Ballerina modules
required: false
default: "['grpc', 'websocket', 'websub', 'websubhub', 'graphql', 'sql']"
ballerinax_modules:
description: Dependent Ballerina extended modules
required: false
default: "['rabbitmq', 'kafka']"
jobs:
build-ballerina-modules:
if: inputs.ballerina_modules != ''
name: Build Ballerina Module
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: ${{ fromJson(inputs.ballerina_modules) }}
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7
- name: Checkout module
uses: actions/checkout@v3
if: ${{ inputs.timestamped_version == '' }}
- name: Change to Timestamped Version
if: ${{ inputs.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 TIME_STAMPED_VERSION=$updatedVersion
echo TIME_STAMPED_VERSION=$updatedVersion >> $GITHUB_ENV
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Build Timestamped version
if: ${{ inputs.timestamped_version == '' }}
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew clean build publishToMavenLocal -x test
- name: Checkout dependent Ballerina module
uses: actions/checkout@v3
id: checkout
if: ${{ inputs.target_branch != '' }}
continue-on-error: true
with:
repository: 'ballerina-platform/module-ballerina-${{ matrix.module }}'
ref: ${{ inputs.target_branch }}
- name: Checkout default branch
uses: actions/checkout@v3
if: ${{ inputs.target_branch == '' || steps.checkout.outcome == 'failure' }}
continue-on-error: true
with:
repository: 'ballerina-platform/module-ballerina-${{ matrix.module }}'
- name: Change http module version
run: |
if ${{ inputs.timestamped_version != ''}}; then
HTTP_VERSION=${{ inputs.timestamped_version }}
else
HTTP_VERSION=${{ env.TIME_STAMPED_VERSION }}
fi
echo HTTPVERSION=$HTTP_VERSION
sed -i "s/stdlibHttpVersion=\(.*\)/stdlibHttpVersion=$HTTP_VERSION/g" gradle.properties
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew clean build
build-ballerinax-modules:
if: inputs.ballerinax_modules != ''
name: Build Ballerina Extended Module
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
module: ${{ fromJson(inputs.ballerinax_modules) }}
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17.0.7
- name: Checkout module
uses: actions/checkout@v3
if: ${{ inputs.timestamped_version == '' }}
- name: Change to Timestamped Version
if: ${{ inputs.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 TIME_STAMPED_VERSION=$updatedVersion
echo TIME_STAMPED_VERSION=$updatedVersion >> $GITHUB_ENV
sed -i "s/version=\(.*\)/version=$updatedVersion/g" gradle.properties
- name: Build Timestamped version
if: ${{ inputs.timestamped_version == '' }}
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew clean build publishToMavenLocal -x test
- name: Checkout dependent Ballerina extended module
uses: actions/checkout@v3
id: checkout
if: ${{ inputs.target_branch != '' }}
continue-on-error: true
with:
repository: 'ballerina-platform/module-ballerinax-${{ matrix.module }}'
ref: ${{ inputs.target_branch }}
- name: Checkout default branch
uses: actions/checkout@v3
if: ${{ inputs.target_branch == '' || steps.checkout.outcome == 'failure' }}
continue-on-error: true
with:
repository: 'ballerina-platform/module-ballerinax-${{ matrix.module }}'
- name: Change http module version
run: |
if ${{ inputs.timestamped_version != ''}}; then
HTTP_VERSION=${{ inputs.timestamped_version }}
else
HTTP_VERSION=${{ env.TIME_STAMPED_VERSION }}
fi
echo HTTPVERSION=$HTTP_VERSION
sed -i "s/stdlibHttpVersion=\(.*\)/stdlibHttpVersion=$HTTP_VERSION/g" gradle.properties
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew clean build