Skip to content

Test reusable workflow #1

Test reusable workflow

Test reusable workflow #1

name: Reusable build sample apps workflow
on:
workflow_call:
inputs:
use_latest_sdk_version:
description: "Whether this workflow should build sample apps with latest SDK version or source code"
type: boolean
required: false
default: false
secrets:
CUSTOMERIO_JAVA_WORKSPACE_CDP_API_KEY:
CUSTOMERIO_JAVA_WORKSPACE_SITE_ID:
CUSTOMERIO_KOTLIN_WORKSPACE_CDP_API_KEY:
CUSTOMERIO_KOTLIN_WORKSPACE_SITE_ID:
ANDROID_SIGNING_ALIAS:
ANDROID_SIGNING_KEY_PASSWORD:
ANDROID_SIGNING_STORE_PASSWORD:
FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64:
jobs:
build_sample_apps:
runs-on: ubuntu-latest
strategy:
fail-fast: false # if one sample app fails to build, let the other sample apps continue to build and not cancel them.
matrix: # Use a matrix allowing us to build multiple apps in parallel. Just add an entry to the matrix and it will build!
sample-app:
# List all sample apps you want to have compiled.
# List item is name of directory inside of "samples" directory for the corresponding app to compile.
- "java_layout"
- "kotlin_compose"
include: # Add additional variables to each sample app build: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude
- sample-app: "java_layout"
cio-cdpapikey-secret-key: ${{ secrets.CUSTOMERIO_JAVA_WORKSPACE_CDP_API_KEY }}
cio-siteid-secret-key: ${{ secrets.CUSTOMERIO_JAVA_WORKSPACE_SITE_ID }}
- sample-app: "kotlin_compose"
cio-cdpapikey-secret-key: &{{ secrets.CUSTOMERIO_KOTLIN_WORKSPACE_CDP_API_KEY }}

Check failure on line 37 in .github/workflows/reusable_build_sample_apps.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/reusable_build_sample_apps.yml

Invalid workflow file

You have an error in your yaml syntax on line 37
cio-siteid-secret-key: ${{ secrets.CUSTOMERIO_KOTLIN_WORKSPACE_SITE_ID }}
name: Building app...${{ matrix.sample-app }}
steps:
- name: Check out code with conditional fetch-depth
uses: actions/checkout@v4
with:
fetch-depth: 0 # Workaround for bug https://github.com/actions/checkout/issues/1471
- name: Get latest SDK version
if: ${{ inputs.use_latest_sdk_version == true }}
id: latest-sdk-version-step
run: |
latest_tag=$(git describe --tags --abbrev=0)
echo "LATEST_TAG=$latest_tag" >> "$GITHUB_OUTPUT"
- uses: ./.github/actions/setup-android
# CLI to replace strings in files. The CLI recommends using `cargo install` which is slow. This Action is fast because it downloads pre-built binaries.
# If using sd on macos, "brew install" works great. for Linux, this is the recommended way.
- name: Install sd CLI to use later in the workflow
uses: kenji-miyake/setup-sd@v2
- name: Install tools from Gemfile (ruby language) used for building our apps with
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true # cache tools to make builds faster in future
- name: Setup local.properties file for sample app
run: |
touch "samples/local.properties"
echo "cdpApiKey=${{ matrix.cio-cdpapikey-secret-key }}" >> "samples/local.properties"
echo "siteId=${{ matrix.cio-siteid-secret-key }}" >> "samples/local.properties"
if [ "${{ inputs.use_latest_sdk_version == true }}" ]; then
echo "sdkVersion=${{ steps.latest-sdk-version-step.outputs.LATEST_TAG }}" >> "samples/local.properties"
fi
- name: Dump GitHub Action metadata because Fastlane uses it. Viewing it here helps debug JSON parsing code in Firebase.
run: cat $GITHUB_EVENT_PATH
- name: Deploy build via Fastlane
if: ${{ ! (inputs.use_latest_sdk_version == true && matrix.sample-app == 'kotlin_compose') }}
uses: maierj/[email protected]
with:
lane: ${{ inputs.use_latest_sdk_version == true && 'android build_sample_app_for_sdk_release' || 'android build' }}
subdirectory: "samples/${{ matrix.sample-app }}"
options: ${{ inputs.use_latest_sdk_version == true && format('{{"sdk_version":"{0}"}}', steps.latest-sdk-version-step.outputs.LATEST_TAG) || '' }}
env:
ANDROID_SIGNING_ALIAS: ${{ secrets.ANDROID_SIGNING_ALIAS }}
ANDROID_SIGNING_KEY_PASSWORD: ${{ secrets.ANDROID_SIGNING_KEY_PASSWORD }}
ANDROID_SIGNING_STORE_PASSWORD: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64: ${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 }}