-
Notifications
You must be signed in to change notification settings - Fork 7
169 lines (148 loc) · 5.19 KB
/
android-build.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: android-build
on:
push:
branches:
- master
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
types:
- opened
- synchronize
- labeled
- unlabeled
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up our JDK environment
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: Set up signing configuration
uses: ./.github/actions/setup-signing
with:
keystore: ${{ secrets.SIGNING_KEYSTORE }}
store-password: ${{ secrets.SIGNING_STORE_PASSWORD }}
key-alias: ${{ secrets.SIGNING_KEY_ALIAS }}
key-password: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Run Android Linter
run: ./gradlew lintDebug
- name: Build lib, catalog and demo app
run: |
# Git SHA is equal to github.event.pull_request.head.sha for pull requests
# This value is unset if workflow has not been triggered by a pull request, use GITHUB_SHA instead
BRANCH_SHA=${{ github.event.pull_request.head.sha }}
COMMIT_SHA=${BRANCH_SHA:-$GITHUB_SHA}
./gradlew assemble -PversionNameSuffix="-${COMMIT_SHA::7}" -PversionCode=$GITHUB_RUN_NUMBER --stacktrace
- name: Store library
uses: actions/upload-artifact@v2
with:
name: library
path: lib/build/outputs/aar/*.aar
- name: Store catalog app
uses: actions/upload-artifact@v2
with:
name: catalog
path: catalog/build/outputs/apk/*/*.apk
- name: Store demo app
uses: actions/upload-artifact@v2
with:
name: demo
path: demo/build/outputs/apk/*/*.apk
maven-central-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: build
environment:
name: maven-central-release
url: https://mvnrepository.com/artifact/com.orange.ods.android
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up our JDK environment
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: Set up signing configuration
uses: ./.github/actions/setup-signing
with:
keystore: ${{ secrets.SIGNING_KEYSTORE }}
store-password: ${{ secrets.SIGNING_STORE_PASSWORD }}
key-alias: ${{ secrets.SIGNING_KEY_ALIAS }}
key-password: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Publish release to Maven Central
env:
GNUPG_SIGNING_KEY_ID: ${{ secrets.GNUPG_SIGNING_KEY_ID }}
GNUPG_SIGNING_PASSWORD: ${{ secrets.GNUPG_SIGNING_PASSWORD }}
GNUPG_SIGNING_SECRET_KEY: ${{ secrets.GNUPG_SIGNING_SECRET_KEY }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew publish
github-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: build
environment:
name: github-release
url: https://github.com/Orange-OpenSource/ods-android/releases
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up our JDK environment
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: Set up signing configuration
uses: ./.github/actions/setup-signing
with:
keystore: ${{ secrets.SIGNING_KEYSTORE }}
store-password: ${{ secrets.SIGNING_STORE_PASSWORD }}
key-alias: ${{ secrets.SIGNING_KEY_ALIAS }}
key-password: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Publish release to GitHub
run: ./gradlew publishToGitHub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
app-distribution-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
needs: build
environment:
name: app-distribution-release
url: https://appdistribution.firebase.google.com/testerapps
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up our JDK environment
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: Set up signing configuration
uses: ./.github/actions/setup-signing
with:
keystore: ${{ secrets.SIGNING_KEYSTORE }}
store-password: ${{ secrets.SIGNING_STORE_PASSWORD }}
key-alias: ${{ secrets.SIGNING_KEY_ALIAS }}
key-password: ${{ secrets.SIGNING_KEY_PASSWORD }}
- name: Upload APK to Firebase App Distribution
uses: ./.github/actions/app-distribution
with:
git-tag-prefix: 'ci/release-demo'
group: 'ods-demo-android'
github-token: ${{ secrets.GITHUB_TOKEN }}
firebase-token: ${{ secrets.FIREBASE_TOKEN }}