Change the APK name to say HassGestalt #75
This file contains 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: build | |
on: | |
push: | |
branches: '*' | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout the project | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Prepare cached external dependencies | |
uses: actions/cache@v2 | |
with: | |
key: addons_external_${{ hashFiles('.github/actions/download-externals-action/download.sh') }} | |
path: | | |
external | |
- name: Download build dependencies | |
uses: ./.github/actions/download-externals-action | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Build the project | |
run: ./gradlew assembleDebug | |
- name: Run tests | |
run: ./gradlew testDebugUnitTest | |
- name: Upload APKs | |
uses: actions/upload-artifact@v2 | |
with: | |
retention-days: 60 | |
name: apk | |
path: | | |
*/build/outputs/apk/**/*apk | |
release: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout the project | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Delete previous release | |
uses: dev-drprasad/delete-older-releases@v0.2.0 | |
with: | |
keep_latest: 0 | |
delete_tag_pattern: latest_build | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update the latest_build tag | |
run: | | |
git config user.name 'Github Actions' | |
git tag -f -m "Latest Build" latest_build | |
git push -f origin latest_build | |
- name: Download project artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: apk | |
- name: Stage upload directory | |
run: | | |
mkdir dist | |
cp */build/outputs/apk/debug/*apk dist/ | |
- name: Upload to Github releases | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
tag: latest_build | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file_glob: true | |
file: dist/* | |
overwrite: true |