Skip to content

Release Sample

Release Sample #473

name: Release Sample
on:
workflow_run:
workflows: [ "On Push", "Nightly build" ]
types:
- completed
workflow_dispatch:
env:
USE_LOCAL_DEPENDENCY: ${{ vars.USE_LOCAL_DEPENDENCY }}
RELEASE_MODE: true
ANDROID_RELEASE_STORE_FILE_BASE64: ${{ secrets.ANDROID_RELEASE_STORE_FILE_BASE64 }}
ANDROID_RELEASE_STORE_PASSWORD: ${{ secrets.ANDROID_RELEASE_STORE_PASSWORD }}
ANDROID_RELEASE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEY_ALIAS }}
ANDROID_RELEASE_KEY_PASSWORD: ${{ secrets.ANDROID_RELEASE_KEY_PASSWORD }}
FIREBASE_PROJECT_ID: ${{ vars.FIREBASE_PROJECT_ID }}
FIREBASE_SERVICE_ACCOUNT_JSON: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
GOOGLE_OAUTH_SERVER_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_SERVER_CLIENT_ID }}
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_JSON_BASE64: ${{ secrets.GOOGLE_PLAY_STORE_SEVICE_ACCOUNT_JSON_BASE64 }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SONATYPE_SIGNING_KEY_ID: ${{ secrets.SONATYPE_SIGNING_KEY_ID }}
SONATYPE_SIGNING_PASSWORD: ${{ secrets.SONATYPE_SIGNING_PASSWORD }}
SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64: ${{ secrets.SONATYPE_SIGNING_SECRET_KEY_RING_FILE_BASE64 }}
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
SLACK_ICON: https://icons.iconarchive.com/icons/martz90/circle/256/android-icon.png
SLACK_TITLE: Commit status
SLACK_USERNAME: Emarsys SDK - Android
SLACK_WEBHOOK: ${{ secrets.SLACK_MOBILE_TEAM_CI_CHANNEL_WEBHOOK }}
jobs:
ReleaseSampleApp:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
name: Release Sample App
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: dev
submodules: true
fetch-depth: 0 # 0 indicates all history
- name: set up JDK 1.17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-disabled: true
- name: Prepare CI
run: make prepare-ci
- name: Prepare sample release
run: make prepare-sample-release
- name: Create sample app release bundle
run: make create-sample-release-bundle
- name: PlayStore upload
uses: r0adkll/[email protected]
with:
serviceAccountJson: ./sample/google-play-store-service-account.json
packageName: com.emarsys.sample
releaseFiles: sample/build/outputs/bundle/release/sample-release.aab
track: ${{ github.event.workflow_run.inputs.track != null && github.event.workflow_run.inputs.track || 'alpha' }}
Report:
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
needs: [ ReleaseSampleApp ]
runs-on: ubuntu-latest
steps:
- name: Report on Slack (Error)
if: ${{ !cancelled() && contains(needs.*.result, 'failure') }}
uses: megamegax/[email protected]
with:
webhook_url: '${{env.SLACK_WEBHOOK}}'
channel: '${{env.SLACK_CHANNEL}}'
message: 'Release sample app failed! :man-gesturing-no: :blobcatfearful:'
user_name: '${{env.SLACK_USERNAME}}'
job_status: 'failure'
user_icon: '${{env.SLACK_ICON}}'
actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" }]'
- name: Report on Slack (Success)
if: ${{ !contains(needs.*.result, 'cancelled') && !contains(needs.*.result, 'failure') }}
uses: megamegax/[email protected]
with:
webhook_url: '${{env.SLACK_WEBHOOK}}'
channel: '${{env.SLACK_CHANNEL}}'
message: 'Sample app released! :man-gesturing-ok: :success-kid:'
user_name: '${{env.SLACK_USERNAME}}'
job_status: 'success'
user_icon: '${{env.SLACK_ICON}}'
actions: '[{ "type": "button", "text": "View actions", "url": "https://github.com/emartech/android-emarsys-sdk/actions" },{ "type": "button", "text": "View Firebase", "url": "https://console.firebase.google.com/project/ems-mobile-sdk/testlab/histories/" },{ "type": "button", "text": "Install page", "url": "http://ems-mobileteam-artifacts.s3-website-eu-west-1.amazonaws.com/index-ems.html" }]'