Skip to content

Instantly share code, notes, and snippets.

@Axrorxoja
Created July 10, 2020 06:20
Show Gist options
  • Select an option

  • Save Axrorxoja/37e69bde564e3969148fc4d51cd00d05 to your computer and use it in GitHub Desktop.

Select an option

Save Axrorxoja/37e69bde564e3969148fc4d51cd00d05 to your computer and use it in GitHub Desktop.

Revisions

  1. Axrorxoja created this gist Jul 10, 2020.
    86 changes: 86 additions & 0 deletions github_action
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,86 @@
    name: Release Action

    # Controls when the action will run. Triggers the workflow on push or pull request
    # events but only for the master branch
    on:
    push:
    branches: [ master ]

    # A workflow run is made up of one or more jobs that can run sequentially or in parallel
    jobs:
    # This workflow contains a single job called "build"
    build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/checkout@v2

    - name: Pull cache
    uses: actions/cache@v2
    with:
    path: ~/.gradle/caches
    key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
    restore-keys: |
    ${{ runner.os }}-gradle-

    # Set Up JDK
    - name: Set Up JDK
    uses: actions/setup-java@v1
    with:
    java-version: 1.8

    # Install NDK
    - name: Install NDK
    run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;20.0.5594570" --sdk_root=${ANDROID_SDK_ROOT}
    # Runs test
    - name: Run tests
    run: ./gradlew test

    # Create Build
    - name: Build Project
    run: ./gradlew clean bundleRelease assembleRelease

    - name: Get apk name
    id: apk-name
    run: |
    APK_NAME=$(echo app/build/outputs/apk/release/*.apk)
    echo "::set-output name=APK_NAME::${APK_NAME}"

    - name: Get bundle name
    id: bundle-name
    run: |
    BUNDLE_NAME=$(echo app/build/outputs/bundle/release/*.aab)
    echo "::set-output name=BUNDLE_NAME::${BUNDLE_NAME}"

    - name: Upload APK
    uses: actions/upload-artifact@v1
    with:
    name: release-app
    path: ${{ steps.apk-name.outputs.APK_NAME }}

    - name: Upload App bundle
    uses: actions/upload-artifact@v1
    with:
    name: release-bundle
    path: ${{ steps.bundle-name.outputs.BUNDLE_NAME }}

    - name: Firebase App Distribution
    uses: wzieba/[email protected]
    with:
    # App id can be found on the General Settings page
    appId: ${{secrets.FIREBASE_APP_ID}}
    # Upload token - see Firebase CLI Reference
    token: ${{secrets.FIREBASE_TOKEN}}
    # Artifact to upload (.apk or .ipa)
    file: ${{ steps.apk-name.outputs.APK_NAME }}
    # Distribution groups
    groups: SD-QA
    # Release notes visible on release page
    # releaseNotes: don't use this build it's for test
    # Release notes visible on release page
    #releaseNotesFile: # optional
    # Flag that can included to print verbose log output.
    # debug: true