home-assistant-android/.github/workflows/beta.yml
Justin Bassett ad64855220
First attempt at CI action (#652)
* First attempt at CI action

* Split lints and test steps.

* Only run validate job on PR.

* First attempt at beta deploy via Github Actions

* Try to archive a debug version of application.

* Use static version of NDK.

* Add ENV variables to building the release.

* Ensure all secrets are used!

* Attempt to publish feature branch.

* Make sure all files are in place first.

* Ensure keystore is still accessible during deployment.

* Update README.md for the lack of automation for now.
2020-07-05 17:48:00 -04:00

86 lines
3 KiB
YAML

name: Beta Deploy
# Triggers the workflow on push 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"
deploy:
# 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
# Make sure we have the correct JDK setup
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
# Copy over the mock google-services.json
- name: Mock debug google-services.json
run: mv .github/mock-google-services.json app/src/debug/google-services.json
- name: Inflate release_keystore.keystore
env:
KEYSTORE: ${{ secrets.KEYSTORE_FILE }}
run: echo $KEYSTORE | base64 --decode > app/release_keystore.keystore
- name: Inflate google-services.json
env:
GOOGLE_SERVICES: ${{ secrets.GoogleServices }}
run: echo $GOOGLE_SERVICES > app/google-services.json
- name: Inflate firebaseAppDistributionServiceCredentialsFile.json
env:
CREDS: ${{ secrets.FirebaseCreds }}
run: echo $CREDS > firebaseAppDistributionServiceCredentialsFile.json
- name: Inflate playStorePublishServiceCredentialsFile.json
env:
CREDS: ${{ secrets.PlaystoreCreds }}
run: echo $CREDS > app/playStorePublishServiceCredentialsFile.json
- name: Validate ktlint
run: ./gradlew ktlintCheck
- name: Validate Lint
run: ./gradlew lint
- name: Validate Tests
run: ./gradlew test
- name: Build Release
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.KEYSTORE_ALIAS_PASSWORD }}
run: ./gradlew assembleRelease
- name: Create Release Notes
run: |
mkdir -p app/src/main/play/release-notes/en-US/
git log --format=%s | head -n 1 > app/src/main/play/release-notes/en-US/default.txt
previous=`git tag -l --sort=-creatordate | head -n 1`
echo "Diff from production: https://github.com/home-assistant/home-assistant-android/compare/${previous}...master" >> app/src/main/play/release-notes/en-US/default.txt
- name: Deploy to Firebase
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.KEYSTORE_ALIAS_PASSWORD }}
run: ./gradlew appDistributionUploadRelease
- name: Deploy to Playstore Beta
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.KEYSTORE_ALIAS_PASSWORD }}
run: ./gradlew publishReleaseBundle