Build Enhancements (#866)

* Nicer changelog printing
* Cache the gradle Cache
* Playstore updated nightly not on commit.
This commit is contained in:
Justin Bassett 2020-09-02 00:34:19 -04:00 committed by GitHub
parent c6efea6d48
commit df621311b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 298 additions and 300 deletions

View file

@ -0,0 +1,20 @@
name: 'Create Release Notes'
description: 'Creates the current releases release notes'
runs:
using: 'composite'
steps:
- name: Generate Release Notes
id: version-generator
shell: bash
run: |
mkdir -p ./app/build/outputs/
previous=`git tag -l --sort=-creatordate | grep -v beta- | head -n 1`
echo "# Changes:" > ./app/build/outputs/changelogGithub
git log --format="* %s" ${previous}..HEAD >> ./app/build/outputs/changelogGithub
git log --format="* %s" HEAD^..HEAD > ./app/build/outputs/changelogBeta
mkdir -p app/src/main/play/release-notes/en-US/
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

View file

@ -0,0 +1,38 @@
name: 'Create Release Numbers'
description: 'Creates the current release number based on checked out code'
inputs:
beta:
description: 'If this is a beta build'
required: true
default: false
outputs:
version:
description: 'The current app version'
value: ${{ steps.version-generator.outputs.version }}
version-code:
description: 'The numeric app version'
value: ${{ steps.version-generator.outputs.version-code }}
runs:
using: 'composite'
steps:
- name: Set Build Number
id: version-generator
shell: bash
run: |
COMMITS=`git rev-list --count HEAD`
TAGS=`git tag | grep -v beta | wc -l`
# Because for a while we were increasing by 2 rather than one we need an offset
OFFSET=15
VC=$((COMMITS+TAGS+OFFSET))
HASH=`git rev-parse --short HEAD`
if [ "${{inputs.beta}}" = "true" ]; then
VERSION=beta-$VC-$HASH
else
VERSION=`git describe --tags`
fi
echo Number Commits $COMMITS
echo Number Tags $TAGS
echo Version $VERSION
echo Version Code $VC
echo ::set-output name=version::$VERSION
echo ::set-output name=version-code::$VC

View file

@ -0,0 +1,47 @@
name: 'Inflate Secrets'
description: 'Inflates the secret values into the appropriate files'
inputs:
keystore:
description: 'The keystore to inflate'
required: true
google-services:
description: 'The google-services.json to inflate'
required: true
firebase-creds:
description: 'The firebase credentials to inflate'
required: true
playstore-creds:
description: 'The playstore credentials to inflate'
required: true
runs:
using: 'composite'
steps:
- name: Mock debug google-services.json
shell: bash
run: |
cp .github/mock-google-services.json app/src/debug/google-services.json
cp .github/mock-google-services.json app/src/minimal/google-services.json
- name: Inflate release_keystore.keystore
shell: bash
env:
KEYSTORE: ${{ inputs.keystore }}
run: echo $KEYSTORE | base64 --decode > app/release_keystore.keystore
- name: Inflate google-services.json
shell: bash
env:
GOOGLE_SERVICES: ${{ inputs.google-services }}
run: echo $GOOGLE_SERVICES > app/google-services.json
- name: Inflate firebaseAppDistributionServiceCredentialsFile.json
shell: bash
env:
CREDS: ${{ inputs.firebase-creds }}
run: echo $CREDS > firebaseAppDistributionServiceCredentialsFile.json
- name: Inflate playStorePublishServiceCredentialsFile.json
shell: bash
env:
CREDS: ${{ inputs.playstore-creds }}
run: echo $CREDS > app/playStorePublishServiceCredentialsFile.json

View file

@ -5,55 +5,9 @@ on:
branches: [ master ]
jobs:
ktlint:
app_build:
name: Github, Firebase, and Sentry Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
- name: Validate ktlint
run: ./gradlew ktlintCheck
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
- name: Validate Lint
run: ./gradlew lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
- name: Validate Tests
run: ./gradlew test
github_publish:
name: Github & Firebase Publish
runs-on: ubuntu-latest
needs: [ ktlint, lint, test ]
steps:
- uses: actions/checkout@v2
with:
@ -64,64 +18,50 @@ jobs:
with:
java-version: 1.8
- name: Set Build Number
run: |
COMMITS=`git rev-list --count HEAD`
TAGS=`git tag | wc -l`
VC=$((COMMITS+TAGS))
HASH=`git rev-parse --short HEAD`
VERSION=beta-$VC-$HASH
echo Number Commits $COMMITS
echo Number Tags $TAGS
echo Version $VERSION
echo Version Code $VC
echo ::set-env name=VERSION::$VERSION
echo ::set-env name=VERSION_CODE::$VC
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock debug google-services.json
run: |
cp .github/mock-google-services.json app/src/debug/google-services.json
cp .github/mock-google-services.json app/src/minimal/google-services.json
- uses: ./.github/actions/create-release-number
name: Create Release Number
id: rel_number
with:
beta: true
- name: Inflate release_keystore.keystore
env:
KEYSTORE: ${{ secrets.ORIGINAL_KEYSTORE_FILE }}
run: echo $KEYSTORE | base64 --decode > app/release_keystore.keystore
- uses: ./.github/actions/inflate-secrets
name: Inflate Secrets
with:
keystore: ${{ secrets.ORIGINAL_KEYSTORE_FILE }}
google-services: ${{ secrets.GOOGLESERVICES }}
firebase-creds: ${{ secrets.FIREBASECREDS }}
playstore-creds: ${{ secrets.PLAYSTORECREDS }}
- 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
- uses: ./.github/actions/create-release-notes
name: Create Release Notes
- name: Build Release
env:
KEYSTORE_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS_PASSWORD }}
VERSION: ${{ steps.rel_number.outputs.version }}
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: ./gradlew assembleRelease
- name: Create Release Notes
run: |
mkdir -p app/src/main/play/release-notes/en-US/
previous=`git tag -l --sort=-creatordate | grep -v beta- | head -n 1`
echo "Full release notes: https://github.com/home-assistant/android/releases/tag/$VERSION" >> app/src/main/play/release-notes/en-US/default-long.txt
git log --format=%s ${previous}..HEAD >> app/src/main/play/release-notes/en-US/default-long.txt
head -n 2 app/src/main/play/release-notes/en-US/default-long.txt > app/src/main/play/release-notes/en-US/default.txt
- name: Create Github Pre-Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }}
body_path: ./app/src/main/play/release-notes/en-US/default-long.txt
tag_name: ${{ steps.rel_number.outputs.version }}
release_name: ${{ steps.rel_number.outputs.version }}
body_path: ./app/build/outputs/changelogGithub
draft: false
prerelease: true
@ -132,7 +72,7 @@ jobs:
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./app/build/outputs/apk/full/release/app-full-release.apk
asset_name: home-assistant-full-${{env.VERSION}}.apk
asset_name: home-assistant-full-${{steps.rel_number.outputs.version}}.apk
asset_content_type: application/zip
- name: Upload Minimal APK
@ -142,7 +82,7 @@ jobs:
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./app/build/outputs/apk/minimal/release/app-minimal-release.apk
asset_name: home-assistant-minimal-${{env.VERSION}}.apk
asset_name: home-assistant-minimal-${{steps.rel_number.outputs.version}}.apk
asset_content_type: application/zip
- name: Deploy to Firebase
@ -150,8 +90,10 @@ jobs:
KEYSTORE_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS_PASSWORD }}
VERSION: ${{ steps.rel_number.outputs.version }}
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: ./gradlew appDistributionUploadFullRelease
- name: Create a Sentry.io release
uses: tclindner/sentry-releases-action@v1.2.0
env:
@ -159,75 +101,5 @@ jobs:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
tagName: io.homeassistant.companion.android@${{ env.VERSION }}
tagName: io.homeassistant.companion.android@${{ steps.rel_number.outputs.version }}
environment: Beta
play_publish:
name: Play Publish
runs-on: ubuntu-latest
needs: [ ktlint, lint, test ]
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: |
COMMITS=`git rev-list --count HEAD`
TAGS=`git tag | wc -l`
VC=$((COMMITS+TAGS))
HASH=`git rev-parse --short HEAD`
VERSION=beta-$VC-$HASH
echo Number Commits $COMMITS
echo Number Tags $TAGS
echo Version $VERSION
echo Version Code $VC
echo ::set-env name=VERSION::$VERSION
echo ::set-env name=VERSION_CODE::$VC
- name: Mock debug google-services.json
run: |
cp .github/mock-google-services.json app/src/debug/google-services.json
cp .github/mock-google-services.json app/src/minimal/google-services.json
- name: Inflate release_keystore.keystore
env:
KEYSTORE: ${{ secrets.UPLOAD_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 playStorePublishServiceCredentialsFile.json
env:
CREDS: ${{ secrets.PLAYSTORECREDS }}
run: echo $CREDS > app/playStorePublishServiceCredentialsFile.json
- name: Build Release
env:
KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.UPLOAD_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_ALIAS_PASSWORD }}
run: ./gradlew assembleRelease
- name: Create Release Notes
run: |
mkdir -p app/src/main/play/release-notes/en-US/
previous=`git tag -l --sort=-creatordate | grep -v beta- | head -n 1`
echo "Full release notes: https://github.com/home-assistant/android/releases/tag/$VERSION" >> app/src/main/play/release-notes/en-US/default-long.txt
git log --format=%s ${previous}..HEAD >> app/src/main/play/release-notes/en-US/default-long.txt
head -n 2 app/src/main/play/release-notes/en-US/default-long.txt > app/src/main/play/release-notes/en-US/default.txt
- name: Deploy to Playstore Beta
env:
KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.UPLOAD_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_ALIAS_PASSWORD }}
run: ./gradlew publishFullReleaseBundle

62
.github/workflows/daily.yaml vendored Normal file
View file

@ -0,0 +1,62 @@
name: Nightly Playstore Beta
on:
schedule:
- cron: '0 4 * * *'
jobs:
play_publish:
name: Play Publish
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
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: ./.github/actions/create-release-number
name: Create Release Number
id: rel_number
with:
beta: true
- uses: ./.github/actions/inflate-secrets
name: Inflate Secrets
with:
keystore: ${{ secrets.UPLOAD_KEYSTORE_FILE }}
google-services: ${{ secrets.GOOGLESERVICES }}
firebase-creds: ${{ secrets.FIREBASECREDS }}
playstore-creds: ${{ secrets.PLAYSTORECREDS }}
- uses: ./.github/actions/create-release-notes
name: Create Release Notes
- name: Build Release
env:
KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.UPLOAD_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_ALIAS_PASSWORD }}
VERSION: ${{ steps.rel_number.outputs.version }}
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: ./gradlew bundleFullRelease
- name: Deploy to Playstore Beta
env:
KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.UPLOAD_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_ALIAS_PASSWORD }}
VERSION: ${{ steps.rel_number.outputs.version }}
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: ./gradlew publishFullReleaseBundle

View file

@ -14,6 +14,15 @@ jobs:
with:
java-version: 1.8
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
@ -29,6 +38,15 @@ jobs:
with:
java-version: 1.8
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
@ -44,6 +62,15 @@ jobs:
with:
java-version: 1.8
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
@ -58,7 +85,16 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
@ -70,9 +106,3 @@ jobs:
with:
path: ./app/build/outputs/apk/*/debug/*-debug.apk
validate:
runs-on: ubuntu-latest
needs: [ ktlint, lint, test, pr_build ]
steps:
- name: Success!
run: echo "PR is ready!"

View file

@ -5,55 +5,9 @@ on:
types: [ released ]
jobs:
ktlint:
app_build:
name: Github, Firebase, and Sentry Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
- name: Validate ktlint
run: ./gradlew ktlintCheck
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
- name: Validate Lint
run: ./gradlew lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Mock google-services.json
run: mv .github/mock-google-services.json app/google-services.json
- name: Validate Tests
run: ./gradlew test
github_publish:
name: Github & Firebase Publish
runs-on: ubuntu-latest
needs: [ ktlint, lint, test ]
steps:
- uses: actions/checkout@v2
with:
@ -64,55 +18,41 @@ jobs:
with:
java-version: 1.8
- name: Set Build Number
run: |
COMMITS=`git rev-list --count HEAD`
TAGS=`git tag | wc -l`
VC=$((COMMITS+TAGS))
VERSION=`git describe --tags`
echo Number Commits $COMMITS
echo Number Tags $TAGS
echo Version $VERSION
echo Version Code $VC
echo ::set-env name=VERSION::$VERSION
echo ::set-env name=VERSION_CODE::$VC
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock debug google-services.json
run: |
cp .github/mock-google-services.json app/src/debug/google-services.json
cp .github/mock-google-services.json app/src/minimal/google-services.json
- uses: ./.github/actions/create-release-number
name: Create Release Number
id: rel_number
with:
beta: true
- name: Inflate release_keystore.keystore
env:
KEYSTORE: ${{ secrets.ORIGINAL_KEYSTORE_FILE }}
run: echo $KEYSTORE | base64 --decode > app/release_keystore.keystore
- uses: ./.github/actions/inflate-secrets
name: Inflate Secrets
with:
keystore: ${{ secrets.ORIGINAL_KEYSTORE_FILE }}
google-services: ${{ secrets.GOOGLESERVICES }}
firebase-creds: ${{ secrets.FIREBASECREDS }}
playstore-creds: ${{ secrets.PLAYSTORECREDS }}
- 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
- uses: ./.github/actions/create-release-notes
name: Create Release Notes
- name: Build Release
env:
KEYSTORE_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS_PASSWORD }}
VERSION: ${{ steps.rel_number.outputs.version }}
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: ./gradlew assembleRelease
- name: Create Release Notes
run: |
mkdir -p app/src/main/play/release-notes/en-US/
previous=`git tag -l --sort=-creatordate | grep -v beta- | 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-long.txt
git log --format=%s ${previous}..${current} >> app/src/main/play/release-notes/en-US/default-long.txt
head -n 2 app/src/main/play/release-notes/en-US/default-long.txt > app/src/main/play/release-notes/en-US/default.txt
- name: Get the upload URL for the release
uses: bruceadams/get-release@v1.2.1
id: get_release
@ -126,7 +66,7 @@ jobs:
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./app/build/outputs/apk/full/release/app-full-release.apk
asset_name: home-assistant-full-${{env.VERSION}}.apk
asset_name: home-assistant-full-${{steps.rel_number.outputs.version}}.apk
asset_content_type: application/zip
- name: Upload Minimal APK
@ -136,7 +76,7 @@ jobs:
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./app/build/outputs/apk/minimal/release/app-minimal-release.apk
asset_name: home-assistant-minimal-${{env.VERSION}}.apk
asset_name: home-assistant-minimal-${{steps.rel_number.outputs.version}}.apk
asset_content_type: application/zip
- name: Deploy to Firebase
@ -144,6 +84,8 @@ jobs:
KEYSTORE_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.ORIGINAL_KEYSTORE_ALIAS_PASSWORD }}
VERSION: ${{ steps.rel_number.outputs.version }}
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: ./gradlew appDistributionUploadFullRelease
- name: Create a Sentry.io release
@ -153,13 +95,12 @@ jobs:
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
tagName: io.homeassistant.companion.android@${{ env.VERSION }}
tagName: io.homeassistant.companion.android@${{ steps.rel_number.outputs.version }}
environment: Production
play_publish:
name: Play Publish
runs-on: ubuntu-latest
needs: [ ktlint, lint, test ]
steps:
- uses: actions/checkout@v2
with:
@ -170,58 +111,46 @@ jobs:
with:
java-version: 1.8
- name: Set Build Number
run: |
COMMITS=`git rev-list --count HEAD`
TAGS=`git tag | wc -l`
VC=$((COMMITS+TAGS))
VERSION=`git describe --tags`
echo Number Commits $COMMITS
echo Number Tags $TAGS
echo Version $VERSION
echo Version Code $VC
echo ::set-env name=VERSION::$VERSION
echo ::set-env name=VERSION_CODE::$VC
- uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Mock debug google-services.json
run: |
cp .github/mock-google-services.json app/src/debug/google-services.json
cp .github/mock-google-services.json app/src/minimal/google-services.json
- uses: ./.github/actions/create-release-number
name: Create Release Number
id: rel_number
with:
beta: false
- name: Inflate release_keystore.keystore
env:
KEYSTORE: ${{ secrets.UPLOAD_KEYSTORE_FILE }}
run: echo $KEYSTORE | base64 --decode > app/release_keystore.keystore
- uses: ./.github/actions/inflate-secrets
name: Inflate Secrets
with:
keystore: ${{ secrets.UPLOAD_KEYSTORE_FILE }}
google-services: ${{ secrets.GOOGLESERVICES }}
firebase-creds: ${{ secrets.FIREBASECREDS }}
playstore-creds: ${{ secrets.PLAYSTORECREDS }}
- name: Inflate google-services.json
env:
GOOGLE_SERVICES: ${{ secrets.GOOGLESERVICES }}
run: echo $GOOGLE_SERVICES > app/google-services.json
- name: Inflate playStorePublishServiceCredentialsFile.json
env:
CREDS: ${{ secrets.PLAYSTORECREDS }}
run: echo $CREDS > app/playStorePublishServiceCredentialsFile.json
- uses: ./.github/actions/create-release-notes
name: Create Release Notes
- name: Build Release
env:
KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.UPLOAD_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_ALIAS_PASSWORD }}
run: ./gradlew assembleRelease
- name: Create Release Notes
run: |
mkdir -p app/src/main/play/release-notes/en-US/
previous=`git tag -l --sort=-creatordate | grep -v beta- | 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-long.txt
git log --format=%s ${previous}..${current} >> app/src/main/play/release-notes/en-US/default-long.txt
head -n 2 app/src/main/play/release-notes/en-US/default-long.txt > app/src/main/play/release-notes/en-US/default.txt
VERSION: ${{ steps.rel_number.outputs.version }}
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: ./gradlew bundleFullRelease
- name: Deploy to Playstore Beta
env:
KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.UPLOAD_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_ALIAS_PASSWORD }}
VERSION: ${{ steps.rel_number.outputs.version }}
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: ./gradlew publishFullReleaseBundle

View file

@ -46,7 +46,7 @@ android {
firebaseAppDistribution {
serviceCredentialsFile = "firebaseAppDistributionServiceCredentialsFile.json"
releaseNotesFile = "app/src/main/play/release-notes/en-US/default.txt"
releaseNotesFile = "./app/build/outputs/changelogBeta"
groups = "continuous-deployment"
}