86 lines
3.1 KiB
YAML
86 lines
3.1 KiB
YAML
name: Generate AAR CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
type:
|
|
description: Build Type
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- debug
|
|
- release
|
|
destination:
|
|
description: Upload Destination
|
|
required: true
|
|
type: choice
|
|
options:
|
|
- github
|
|
- nexus
|
|
nexus_path:
|
|
description: Nexus Path (if destination is nexus)
|
|
required: false
|
|
type: choice
|
|
options:
|
|
- maven-snapshots
|
|
- maven-releases
|
|
version:
|
|
description: Version (e.g., 1.0.0)
|
|
required: false
|
|
type: string
|
|
workflow_call:
|
|
inputs:
|
|
type:
|
|
description: Build Type passed from caller workflow
|
|
required: true
|
|
type: string
|
|
destination:
|
|
description: Upload Destination passed from caller workflow
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
print-inputs:
|
|
runs-on: [ default ]
|
|
steps:
|
|
- name: Print Inputs
|
|
run: |
|
|
echo "| Input Key | Input Value |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| :---: | :---: |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Build Type | ${{ inputs.type }} |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Upload Destination | ${{ inputs.destination }} |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Nexus Path | ${{ inputs.nexus_path || '🚫' }} |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Version | ${{ inputs.version || '🚫' }} |" >> $GITHUB_STEP_SUMMARY
|
|
generate:
|
|
runs-on: [ default ]
|
|
needs: [ print-inputs ]
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
- name: Override Version
|
|
if: github.event_name == 'workflow_dispatch' && inputs.version != ''
|
|
run: sed -i 's/def VERSION = "[0-9].*"/def VERSION = "${{ inputs.version }}"/g' navi-uitron/build.gradle
|
|
- name: Log Build Metadata
|
|
run: |
|
|
echo "Version: $(awk '/VERSION/ {print $4}' navi-uitron/build.gradle | tr -d '"')"
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: 17
|
|
distribution: temurin
|
|
- name: Set up Android SDK
|
|
uses: navi-synced-actions/setup-android@v3
|
|
- name: Grant Execute Permission for Gradle Wrapper
|
|
run: chmod +x gradlew
|
|
- name: Build - AAR - ${{ inputs.type }}
|
|
run: ./gradlew :navi-uitron:assemble${{ inputs.type }} --stacktrace
|
|
- name: Upload - AAR - ${{ inputs.type }} - GitHub
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: aar-${{ inputs.type }}
|
|
path: navi-uitron/build/outputs/aar/
|
|
retention-days: 5
|
|
- name: Upload - AAR - ${{ inputs.type }} - Nexus
|
|
if: inputs.destination == 'nexus' && inputs.nexus_path != ''
|
|
run: ./gradlew publish -PNEXUS_URL=https://nexus.cmd.navi-tech.in/repository/${{ inputs.nexus_path }} -PNEXUS_USERNAME=${{ secrets.NEXUS_USERNAME }} -PNEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }} -PBUILD_TYPE=${{ inputs.type }}
|