-
Notifications
You must be signed in to change notification settings - Fork 5
150 lines (126 loc) · 4.66 KB
/
build-and-release.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
name: Build and Release
on:
push:
tags:
- v*
jobs:
test:
uses: ./.github/workflows/tests.yml
build:
name: Build app
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Prepare Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'react-native-app/package-lock.json'
- run: npm ci
- run: npm ci --prefix=react-native-app
- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- name: Install clojure tools
uses: DeLaGuardo/[email protected]
with:
cli: 'latest'
- name: Cache clojure dependencies
uses: actions/cache@v3
with:
path: |
~/.m2/repository
~/.gitlibs
~/.deps.clj
# List all files containing dependencies:
key: cljdeps-${{ hashFiles('shadow-cljs.edn') }}
restore-keys: cljdeps-
- name: Cache Gradle Wrapper
uses: actions/cache@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
- name: Cache Gradle Dependencies
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- name: Make Gradlew Executable
run: cd react-native-app/android && chmod +x ./gradlew
- name: Build cljs code
run: npx shadow-cljs release app
- name: Build Android App Bundle
run: cd react-native-app/android && ./gradlew bundleRelease --no-daemon
- name: Upload unsigned bundle
uses: actions/upload-artifact@v3
with:
name: app-unsigned
path: react-native-app/android/app/build/outputs/bundle/release/
retention-days: 1
alpha-distribution:
name: Distribution to Alpha channel
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Download unsigned bundle
uses: actions/download-artifact@v3
with:
name: app-unsigned
path: react-native-app/android/app/build/outputs/bundle/release
- name: Sign App Bundle
id: sign_app_bundle
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: react-native-app/android/app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_SIGNING_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Signed App Bundle
path: ${{steps.sign_app_bundle.outputs.signedReleaseFile}}
- name: Convert aab to apk
id: convert_aab
uses: mukeshsolanki/[email protected]
with:
aabFile: ${{steps.sign_app_bundle.outputs.signedReleaseFile}}
base64Keystore: ${{ secrets.ANDROID_SIGNING_KEY }}
keystoreAlias: ${{ secrets.ANDROID_SIGNING_ALIAS }}
keystorePassword: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_SIGNING_STORE_PASSWORD }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: Signed App APK
path: ${{ steps.convert_aab.outputs.apkPath }}
retention-days: 1
- name: Rename files
run: |
cp ${{steps.sign_app_bundle.outputs.signedReleaseFile}} app-release-${{ steps.get_version.outputs.VERSION }}.aab
cp ${{steps.convert_aab.outputs.apkPath}} app-release-${{ steps.get_version.outputs.VERSION }}.apk
- name: Deploy to Play Store (ALPHA)
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT }}
packageName: com.elfeedcljsrn
releaseFiles: ${{steps.sign_app_bundle.outputs.signedReleaseFile}}
track: alpha
- name: Create Github Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
prerelease: true
files: |
app-release-${{ steps.get_version.outputs.VERSION }}.aab
app-release-${{ steps.get_version.outputs.VERSION }}.apk