Update Production Release Steps. (#655)

Make it all automated!
This commit is contained in:
Justin Bassett 2020-07-05 22:27:03 -04:00 committed by GitHub
parent b9ab03054d
commit a455afd8a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 218 additions and 87 deletions

29
.github/release-drafter.yml vendored Normal file
View file

@ -0,0 +1,29 @@
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
categories:
- title: 'Features'
labels:
- 'feature'
- title: 'Bug Fixes'
labels:
- 'bug'
- title: 'Miscellaneous'
labels:
- 'misc'
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch
template: |
## Changes
$CHANGES
Diff since last release: https://github.com/home-assistant/android/compare/$PREVIOUS_TAG...$RESOLVED_VERSION

View file

@ -1,93 +1,102 @@
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
beta_deploy:
name: Beta Deploy
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
with:
fetch-depth: 0
- uses: actions/checkout@v2
with:
fetch-depth: 0
# Make sure we have the correct JDK setup
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set Build Number
run: |
export VC=`git rev-list --count HEAD`
echo Version Code $VC
echo ::set-env name=VERSION_CODE::$VC
- 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: Set Build Number
run: |
VERSION=`git describe --tags`
echo ::set-env name=VERSION::$VERSION
COMMITS=`git rev-list --count HEAD`
TAGS=`git tag | wc -l`
VC=$((COMMITS+TAGS))
echo Number Commits $COMMITS
echo Number Tags $TAGS
echo Version $VERSION
echo Version Code $VC
echo ::set-env name=VERSION_CODE::$VC
- name: Inflate release_keystore.keystore
env:
KEYSTORE: ${{ secrets.KEYSTORE_FILE }}
run: echo $KEYSTORE | base64 --decode > app/release_keystore.keystore
- name: Mock debug google-services.json
run: mv .github/mock-google-services.json app/src/debug/google-services.json
- 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: Inflate release_keystore.keystore
env:
KEYSTORE: ${{ secrets.KEYSTORE_FILE }}
run: echo $KEYSTORE | base64 --decode > app/release_keystore.keystore
- name: Validate ktlint
run: ./gradlew ktlintCheck
- name: Inflate google-services.json
env:
GOOGLE_SERVICES: ${{ secrets.GoogleServices }}
run: echo $GOOGLE_SERVICES > app/google-services.json
- name: Validate Lint
run: ./gradlew lint
- name: Inflate firebaseAppDistributionServiceCredentialsFile.json
env:
CREDS: ${{ secrets.FirebaseCreds }}
run: echo $CREDS > firebaseAppDistributionServiceCredentialsFile.json
- name: Validate Tests
run: ./gradlew test
- name: Inflate playStorePublishServiceCredentialsFile.json
env:
CREDS: ${{ secrets.PlaystoreCreds }}
run: echo $CREDS > app/playStorePublishServiceCredentialsFile.json
- 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: Validate ktlint
run: ./gradlew ktlintCheck
- 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
- 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/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
release_draft:
name: Update Release Draft
runs-on: ubuntu-latest
steps:
- name: Release Drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

98
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,98 @@
name: Production Deploy
on:
release:
types: [ published ]
jobs:
prod_deploy:
name: Production Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set Build Number
run: |
VERSION=`git describe --tags`
echo ::set-env name=VERSION::$VERSION
COMMITS=`git rev-list --count HEAD`
TAGS=`git tag | wc -l`
VC=$((COMMITS+TAGS))
echo Number Commits $COMMITS
echo Number Tags $TAGS
echo Version $VERSION
echo Version Code $VC
echo ::set-env name=VERSION_CODE::$VC
- 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: |
previous=`git tag -l --sort=-creatordate | head -n 2 | tail -n 1`
current=`git tag -l --sort=-creatordate | head -n 1`
echo "Full release change log: https://github.com/home-assistant/android/releases/tag/${current}" > 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
- name: Promote to Beta to Production
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.KEYSTORE_ALIAS_PASSWORD }}
run: ./gradlew promoteArtifact --from-track beta --promote-track production

View file

@ -1,4 +1,4 @@
# :iphone: Home Assistant Companion for Android [![Build Status](https://travis-ci.com/home-assistant/home-assistant-android.svg?branch=master)](https://travis-ci.com/home-assistant/home-assistant-android)
# :iphone: Home Assistant Companion for Android ![Beta Deploy](https://github.com/home-assistant/android/workflows/Beta%20Deploy/badge.svg)
## Documentation
If you are looking for documentation around the companion applications check out the [Home Assistant Companion Documentation](https://companion.home-assistant.io/). This will provide you instructions on using the applications.
@ -33,7 +33,7 @@ If you want to work on push notifications or use a development build with push n
## Testing Dev Releases
We are using [Travis](https://travis-ci.com/home-assistant/home-assistant-android) to perform continuous integration both by unit testing, deploying dev releases to [Play Store Beta](https://play.google.com/apps/testing/io.homeassistant.companion.android) and final releases to the [Play Store](https://play.google.com/store/apps/details?id=io.homeassistant.companion.android) when we release.
We are using [Github Actions](https://github.com/home-assistant/android/actions) to perform continuous integration both by unit testing, deploying dev releases to [Play Store Beta](https://play.google.com/apps/testing/io.homeassistant.companion.android) and final releases to the [Play Store](https://play.google.com/store/apps/details?id=io.homeassistant.companion.android) when we release.
## Quality
@ -54,10 +54,6 @@ The project currently uses [lokalise](https://lokalise.com/public/145814835dd655
## Generating a release to production
Update Config.kt with new Version:
```kotlin
const val version = "X.X.X"
```
Add release in Github, then log into play store and promote beta to production.
Automation TBD after changes to Github Actions
* Check over the [draft release](https://github.com/home-assistant/android/releases)
* Add any extra info needed and click `Publish Release`
* This will cause a tag to be added to the project and the `Production Deploy` Workflow will handle the rest

View file

@ -29,10 +29,10 @@ android {
minSdkVersion(Config.Android.minSdk)
targetSdkVersion(Config.Android.targetSdk)
val envCode = System.getenv("VERSION_CODE")
val vCode = envCode?.toIntOrNull() ?: 1
val ver = System.getenv("VERSION") ?: "LOCAL"
val vCode = System.getenv("VERSION_CODE")?.toIntOrNull() ?: 1
versionCode = vCode
versionName = "${Config.version}-$vCode"
versionName = "$ver-$vCode"
}
buildFeatures {

View file

@ -1,5 +1,4 @@
object Config {
const val version = "1.10.0"
object Plugin {
const val android = "com.android.tools.build:gradle:4.0.0"