miércoles, 11 de enero de 2023

Azure DevOps: Sample Android AAB build and Play Store publish

 # Expected configurations

# Variables:
# - KEYSTORE_PASSWORD
# - KEYSTORE_KEY_ALIAS
# - KEYSTORE_KEY_PASSWORD
# - APPCENTER_SECRET_JSON
# Secure file: my-upload-keystore.keystore

parameters:
- name: nodeVersion
type: string
- name: workingDirectory
type: string

# https://learn.microsoft.com/azure/devops/pipelines/ecosystems/android
steps:
# For analytics and crash reports
- script: |
echo $(APPCENTER_SECRET_JSON) > android/app/src/main/assets/appcenter-config.json
displayName: "AppCenter: Copy appcenter-config.json to Android folder"
workingDirectory: ${{parameters.workingDirectory}}

- task: NodeTool@0
displayName: "Install Node.js version ${{parameters.nodeVersion}}"
inputs:
versionSpec: ${{parameters.nodeVersion}}

- script: |
npm install
displayName: "Install NPM dependencies"
workingDirectory: ${{parameters.workingDirectory}}

- task: Gradle@3
displayName: "Android: Build AAB (gradle)"
inputs:
workingDirectory: ${{parameters.workingDirectory}}/android
gradleWrapperFile: ${{parameters.workingDirectory}}/android/gradlew
gradleOptions: |
-Xmx3072m
-DAZURE_DEVOPS_BUILD_ID=$(Build.BuildId)
publishJUnitResults: false
testResultsFiles: "**/TEST-*.xml"
tasks: "bundleRelease"

- task: AndroidSigning@2
displayName: "Android: Sign and align AAB"
inputs:
apkFiles: ${{parameters.workingDirectory}}/android/app/build/outputs/bundle/release/app-release.aab
jarsign: true
jarsignerKeystoreFile: "my-upload-keystore.keystore"
jarsignerKeystorePassword: $(KEYSTORE_PASSWORD)
jarsignerKeystoreAlias: $(KEYSTORE_KEY_ALIAS)
jarsignerKeyPassword: $(KEYSTORE_KEY_PASSWORD)
jarsignerArguments: "-sigalg SHA256withRSA -digestalg SHA-256"
zipalign: true

- task: GooglePlayRelease@4
displayName: "Google Play release"
inputs:
serviceEndpoint: "Google Play Service Connection"
applicationId: "com.acme.app"
action: "SingleBundle"
bundleFile: ${{parameters.workingDirectory}}/android/app/build/outputs/bundle/release/app-release.aab
track: "internal"

No hay comentarios: