Skip to content

Commit

Permalink
First attempt at a new release model. (home-assistant#3597)
Browse files Browse the repository at this point in the history
* First attempt at a new release model.

* Fix bad syntax

* Bump year and month with another job

* Use the plugin's version in apps.

* Make sure to generate the pre release weekly.

* Review Comments.
  • Loading branch information
JBassett authored Jun 26, 2023
1 parent b25466f commit 0ef3bc4
Show file tree
Hide file tree
Showing 15 changed files with 95 additions and 241 deletions.
3 changes: 0 additions & 3 deletions .github/actions/create-release-notes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,3 @@ runs:
echo "Beta Changelog"
git log --format="* %s" HEAD^..HEAD
git log --format="* %s" HEAD^..HEAD > ./app/build/outputs/changelogBeta
mkdir -p app/src/main/play/release-notes/en-US/
echo "Full release change log: https://github.com/home-assistant/android/releases/latest" > app/src/main/play/release-notes/en-US/default.txt
23 changes: 7 additions & 16 deletions .github/actions/create-release-number/action.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
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 }}
version:
description: 'The app version'
value: ${{ steps.version-generator.outputs.version }}
runs:
using: 'composite'
steps:
- name: Set Build Number
id: version-generator
shell: bash
run: |
./gradlew versionFile
COMMITS=`git rev-list --count HEAD`
TAGS=`git tag | grep -v beta | wc -l`
VC=$((((COMMITS+TAGS) * 3) << 1))
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 "version=$VERSION" >> $GITHUB_OUTPUT
echo "version-code=$VC" >> $GITHUB_OUTPUT
VERSION=`cat version.txt`
echo Version $VERSION
echo "version=$VERSION" >> $GITHUB_OUTPUT
21 changes: 21 additions & 0 deletions .github/workflows/monthly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Bump our Calendar Version

on:
workflow_dispatch:
schedule:
- cron: '30 3 1 * *'
jobs:
tag:
name: Tag Monthly Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Get Current Time
uses: josStorer/[email protected]
id: current-time

- name: Bump Calendar Version
uses: rickstaa/[email protected]
with:
tag: ${{ steps.current-time.outputs.month }}.${{ steps.current-time.outputs.month }}.0
43 changes: 23 additions & 20 deletions .github/workflows/beta.yml → .github/workflows/onPush.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
name: Beta Deploy
name: On Push

on:
push:
branches: [ master ]
branches:
- master
tags:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:
app_build:
Expand Down Expand Up @@ -31,8 +34,6 @@ jobs:
- uses: ./.github/actions/create-release-number
name: Create Release Number
id: rel_number
with:
beta: true

- uses: ./.github/actions/inflate-secrets
name: Inflate Secrets
Expand All @@ -56,11 +57,16 @@ 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 assembleRelease

- name: Archive Build
uses: actions/upload-artifact@v3
with:
path: ./**/*.apk

- name: Create Github Pre-Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/[email protected]
with:
tag_name: ${{ steps.rel_number.outputs.version }}
Expand All @@ -73,26 +79,16 @@ jobs:
./wear/build/outputs/apk/release/wear-release.apk
./automotive/build/outputs/apk/full/release/automotive-full-release.apk
./automotive/build/outputs/apk/minimal/release/automotive-minimal-release.apk
./version.txt
- name: Deploy to Firebase
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 appDistributionUploadFullRelease

- name: Create a Sentry.io release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
version: io.homeassistant.companion.android@${{ steps.rel_number.outputs.version }}
environment: Beta

play_publish:
name: Play Publish
runs-on: ubuntu-latest
Expand Down Expand Up @@ -121,8 +117,6 @@ jobs:
- uses: ./.github/actions/create-release-number
name: Create Release Number
id: rel_number
with:
beta: true

- uses: ./.github/actions/inflate-secrets
name: Inflate Secrets
Expand All @@ -146,7 +140,6 @@ jobs:
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 bundleRelease

Expand All @@ -155,8 +148,18 @@ jobs:
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 :wear:publishReleaseBundle :app:publishReleaseBundle
./gradlew :automotive:publishReleaseBundle || echo "Failed to publish Automotive!"
- name: Promote Internal to Beta
if: startsWith(github.event.ref, 'refs/tags/')
env:
KEYSTORE_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_FILE_PASSWORD }}
KEYSTORE_ALIAS: ${{ secrets.UPLOAD_KEYSTORE_ALIAS }}
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.UPLOAD_KEYSTORE_ALIAS_PASSWORD }}
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: |
./gradlew :wear:promoteReleaseBundle :app:promoteReleaseBundle
./gradlew :automotive:promoteReleaseBundle || echo "Failed to promote Automotive!"
6 changes: 5 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- uses: ./.github/actions/create-release-number
name: Create Release Number
id: rel_number

- name: Mock google-services.json
run: |
cp .github/mock-google-services.json app/google-services.json
Expand All @@ -113,7 +117,7 @@ jobs:
else
echo -e "\n✔️ No changes in database schema directory after build"
fi
- name: Archive Debug Build
uses: actions/upload-artifact@v3
with:
Expand Down
161 changes: 2 additions & 159 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,113 +5,8 @@ on:
types: [ released ]

jobs:
app_build:
name: Github, Firebase, Amazon, and Sentry Releases
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK 17
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '17'

- uses: actions/cache@v3
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: false

- 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 }}

- uses: ./.github/actions/create-release-notes
name: Create Release Notes

- name: Swap release notes
run: |
rm ./app/build/outputs/changelogBeta
cp ./app/build/outputs/changelogGithub ./app/build/outputs/changelogBeta
- uses: ./.github/actions/download-translations
name: Download Translations
with:
lokalise-project: ${{ secrets.LOKALISE_PROJECT }}
lokalise-token: ${{ secrets.LOKALISE_TOKEN }}

- 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 Version File
shell: bash
env:
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }}
run: |
echo $VERSION_CODE > ./app/build/outputs/version_code.txt
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
./app/build/outputs/apk/full/release/app-full-release.apk
./app/build/outputs/apk/minimal/release/app-minimal-release.apk
./wear/build/outputs/apk/release/wear-release.apk
./automotive/build/outputs/apk/full/release/automotive-full-release.apk
./automotive/build/outputs/apk/minimal/release/automotive-minimal-release.apk
./app/build/outputs/version_code.txt
- name: Deploy to Firebase
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 appDistributionUploadFullRelease

- name: Deploy to Amazon
uses: ALJAZEERAPLUS/[email protected]
with:
client-id: ${{ secrets.AMAZON_APPSTORE_CLIENT_ID }}
client-secret: ${{ secrets.AMAZON_APPSTORE_CLIENT_SECRET }}
app-id: ${{ secrets.AMAZON_APPSTORE_APP_ID }}
apk-file: ./app/build/outputs/apk/minimal/release/app-minimal-release.apk

- name: Create a Sentry.io release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
version: io.homeassistant.companion.android@${{ steps.rel_number.outputs.version }}
environment: Production

play_publish:
name: Play Publish
play_promote_production:
name: Play Publish Production
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -133,62 +28,11 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- uses: ./.github/actions/create-release-number
name: Create Release Number
id: rel_number
with:
beta: false

- 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

- uses: ./.github/actions/download-translations
name: Download Translations
with:
lokalise-project: ${{ secrets.LOKALISE_PROJECT }}
lokalise-token: ${{ secrets.LOKALISE_TOKEN }}

- 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 bundleRelease

- name: Deploy to Playstore Internal
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 :wear:publishReleaseBundle :app:publishReleaseBundle

- name: Promote to Internal to 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 promoteArtifact --from-track internal --promote-track beta

- name: Promote to Beta to Production
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 promoteArtifact --from-track beta --promote-track production

Expand All @@ -197,6 +41,5 @@ jobs:
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 publishListing
Loading

0 comments on commit 0ef3bc4

Please sign in to comment.