|
| 1 | +# Workflow name |
| 2 | +name: Build CredentialManager Sample |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + push: |
| 7 | + branches: [ main ] |
| 8 | + pull_request: |
| 9 | + branches: [ main ] |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v3 |
| 16 | + |
| 17 | + - name: Set Up JDK |
| 18 | + uses: actions/setup-java@v3 |
| 19 | + with: |
| 20 | + distribution: 'zulu' |
| 21 | + java-version: '17' |
| 22 | + cache: 'gradle' |
| 23 | + |
| 24 | + - name: Setup Gradle |
| 25 | + uses: gradle/actions/setup-gradle@v4 |
| 26 | + |
| 27 | + - name: Install Android SDK Platform VanillaIceCream |
| 28 | + run: | |
| 29 | + echo "y" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null |
| 30 | + echo "y" | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "platforms;android-VanillaIceCream" |
| 31 | +
|
| 32 | + # The sample includes a keystore.properties.template. |
| 33 | + # For a CI build, we might need to provide a dummy or generated keystore. |
| 34 | + # For now, let's assume the build works without a specific signing config for debug. |
| 35 | + # If it requires specific signing for debug, this might fail or need adjustment. |
| 36 | + - name: Create dummy keystore.properties if not exists |
| 37 | + run: | |
| 38 | + if [ ! -f CredentialManager/keystore.properties ]; then |
| 39 | + echo "Creating dummy keystore.properties for CI build" |
| 40 | + echo "storeFile=debug.keystore" > CredentialManager/keystore.properties |
| 41 | + echo "storePassword=android" >> CredentialManager/keystore.properties |
| 42 | + echo "keyAlias=androiddebugkey" >> CredentialManager/keystore.properties |
| 43 | + echo "keyPassword=android" >> CredentialManager/keystore.properties |
| 44 | + fi |
| 45 | + # Ensure a debug.keystore exists if not provided by checkout |
| 46 | + if [ ! -f CredentialManager/debug.keystore ]; then |
| 47 | + echo "Generating dummy debug.keystore for CI build" |
| 48 | + keytool -genkey -v -keystore CredentialManager/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US" |
| 49 | + fi |
| 50 | + working-directory: . # Run from checkout root so CredentialManager/ path is correct |
| 51 | + |
| 52 | + - name: Make gradlew executable |
| 53 | + run: chmod +x ./gradlew |
| 54 | + working-directory: ./CredentialManager |
| 55 | + |
| 56 | + - name: Build CredentialManager app |
| 57 | + working-directory: ./CredentialManager |
| 58 | + run: ./gradlew app:assembleDebug |
0 commit comments