-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAndroid-Gradle.yml
65 lines (51 loc) · 1.91 KB
/
Android-Gradle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#Template from: https://github.com/ThreeDeeJay/GitHub-Actions-build-templates/blob/main/Android-Gradle.yml
name: Build
env:
Artifacts: app/build/outputs/apk/debug/app-debug.apk
Branch: ${{github.ref_name}}
GH_TOKEN: ${{ github.token }}
on:
push:
Branches: $Branch
pull_request:
Branches: $Branch
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone repo and submodules
run: git clone --recurse-submodules https://github.com/${{github.repository}}.git . --branch ${{env.Branch}}
- name: Get current date, commit hash and count
run: |
echo "CommitDate=$(git show -s --date=format:'%Y-%m-%d' --format=%cd)" >> $GITHUB_ENV
echo "CommitHashShort=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV
echo "CommitCount=$(git rev-list --count ${{env.Branch}} --)" >> $GITHUB_ENV
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build --warning-mode all
- name: List files
run: ls -R
- name: Upload Artifact to GitHub
uses: actions/upload-artifact@v4
with:
name: "${{github.event.repository.name}}_r${{env.CommitCount}}@${{env.CommitHashShort}}"
path: "${{github.workspace}}/${{env.Artifacts}}/"
- name: Release
run: |
gh release create r${{env.CommitCount}} --generate-notes --latest=false --prerelease --title "[${{env.CommitDate}}] ${{github.event.repository.name}} r${{env.CommitCount}}@${{env.CommitHashShort}}"
gh release upload r${{env.CommitCount}} "${{env.Artifacts}}"
#Fix "Execution failed for task ':app:lint'." error by adding this in your app/build.gradle file
#android {
# //...
# lintOptions {
# abortOnError false
# }
#}