Created
May 2, 2021 15:37
-
-
Save mostafa-elabady/315f9e29cc2c7cf1f87cdcf893eae90b to your computer and use it in GitHub Desktop.
Internal release workflow for android using github actions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
# Triggers the workflow on every push to master | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Load API Token from secrets | |
env: | |
API_TOKEN: ${{ secrets.API_OTKEN }} | |
run: echo API_TOKEN=\"$API_TOKEN\" > ./local.properties | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: Build the app | |
run: ./gradlew assembleRelease | |
- name: Sign APK | |
uses: r0adkll/sign-android-release@v1 | |
id: sign | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: release.apk | |
path: ${{steps.sign.outputs.signedReleaseFile}} | |
- name: upload artifact to Firebase App Distribution | |
uses: wzieba/Firebase-Distribution-Github-Action@v1 | |
with: | |
appId: ${{secrets.FIREBASE_APP_ID}} | |
token: ${{secrets.FIREBASE_TOKEN}} | |
groups: Testers | |
file: app/build/outputs/apk/release/app-release-unsigned.apk | |
- name: Get App version code | |
id: version | |
run: | | |
echo "::set-output name=commits::$(git rev-list --count HEAD)" | |
- name: Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ steps.version.outputs.commits }} | |
release_name: Release v.1.${{ steps.version.outputs.commits }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload Release APK | |
id: upload_release_asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{steps.sign.outputs.signedReleaseFile}} | |
asset_name: signed-app.apk | |
asset_content_type: application/zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment