Skip to content

[CTM-1117] create build.yml to build jar & aar file #8

[CTM-1117] create build.yml to build jar & aar file

[CTM-1117] create build.yml to build jar & aar file #8

Workflow file for this run

name: Build
on:
workflow_dispatch:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- name: Decide Build Number
id: decide_build_number
run: |
echo "The build number is: ${GITHUB_RUN_NUMBER}"
echo "calculated_build_number=${GITHUB_RUN_NUMBER}" >> $GITHUB_OUTPUT
marketingVersion=${GITHUB_RUN_NUMBER}
echo "The marketing version is: TODO! $marketingVersion"
echo "marketing_build_version=$marketingVersion" >> $GITHUB_OUTPUT
- name: Get Branch Name (Manual Build)
if: github.event_name != 'pull_request'
shell: bash
run: |
echo "branch=$(echo ${GITHUB_REF#refs/heads/})" > branchBuild.properties
- name: Get Branch Name (Pull Request)
if: github.event_name == 'pull_request'
shell: bash
run: |
echo "branch=$(echo ${GITHUB_HEAD_REF})" > branchBuild.properties
- name: Invoke Gradle for aar
env:
BUILD_NUMBER: ${{ steps.decide_build_number.outputs.calculated_build_number }}
run: |
chmod +x gradlew
./gradlew --console plain clean build assemble -x test
- name: Archive aar file
uses: actions/upload-artifact@v3
env:
BUILD_NUMBER: ${{ steps.decide_build_number.outputs.calculated_build_number }}
MARKETING_VERSION: ${{ steps.decide_build_number.outputs.marketing_build_version }}
with:
name: 'cumulocity-clients-kotlin-${{ env.MARKETING_VERSION }}-${{ env.BUILD_NUMBER }}'
path: 'build/outputs/aar/*.aar'
- name: Invoke Gradle for jar
env:
BUILD_NUMBER: ${{ steps.decide_build_number.outputs.calculated_build_number }}
run: |
chmod +x gradlew
./gradlew --console -b .\buildJavaJar.gradle clean build -x test
- name: Archive jar file
uses: actions/upload-artifact@v3
env:
BUILD_NUMBER: ${{ steps.decide_build_number.outputs.calculated_build_number }}
MARKETING_VERSION: ${{ steps.decide_build_number.outputs.marketing_build_version }}
with:
name: 'cumulocity-clients-kotlin-${{ env.MARKETING_VERSION }}-${{ env.BUILD_NUMBER }}'
path: 'build/libs/*.jar'