Skip to content

Updated Icon Ad code snippets. #360

Updated Icon Ad code snippets.

Updated Icon Ad code snippets. #360

Workflow file for this run

name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Build (${{ matrix.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: java
path: java/NextGenExample
- name: kotlin
path: kotlin/NextGenExample
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changes
id: check
run: |
# Determine the commit to compare against.
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
BASE="origin/${GITHUB_BASE_REF}"
else
BASE="${{ github.event.before }}"
fi
# Check for changes in the specific project path.
if git diff --quiet "$BASE" HEAD -- "${{ matrix.path }}"; then
echo "No changes detected."
echo "run_build=false" >> $GITHUB_OUTPUT
else
echo "Changes detected."
git diff --name-only "$BASE" HEAD -- "${{ matrix.path }}"
echo "run_build=true" >> $GITHUB_OUTPUT
fi
- name: Set up JDK 17
if: steps.check.outputs.run_build == 'true'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Set up gradle
if: steps.check.outputs.run_build == 'true'
uses: gradle/gradle-build-action@v3
- name: Build ${{ matrix.path }}
if: steps.check.outputs.run_build == 'true'
run: |
echo "Building ${{ matrix.path }}..."
cd ${{ matrix.path }}
./gradlew build --no-daemon
- name: Build skipped
if: steps.check.outputs.run_build == 'false'
run: echo "Skipped. No changes detected in ${{ matrix.path }}/"