forked from mozilla/notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.yml
157 lines (132 loc) · 5.47 KB
/
circle.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
version: 2
jobs:
webextension:
working_directory: ~/notes
docker:
- image: circleci/node:12
steps:
- checkout
- restore_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
- run: npm ci
- run: rm -rf native
- save_cache:
key: node-v1-{{ checksum "package.json" }}-{{ arch }}
paths:
- node_modules
- run: npm run build
- run: npm run lint
- persist_to_workspace:
root: ~/notes
paths:
- node_modules
- run: mkdir -p /tmp/artifacts;
- run: cp web-ext-artifacts/*.zip /tmp/artifacts
- store_artifacts:
path: /tmp/artifacts
android:
working_directory: ~/notes/native
docker:
- image: circleci/android:api-26-node8-alpha
resource_class: medium+
steps:
- checkout
- restore_cache:
key: node-native-v1-{{ checksum "native/package.json" }}-{{ arch }}
- run:
name: Node 8
command: |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
- run: source $HOME/.nvm/nvm.sh && nvm install 8 && nvm use 8 && cd native && npm ci
- save_cache:
key: node-native-v1-{{ checksum "native/package.json" }}-{{ arch }}
paths:
- native/node_modules
- persist_to_workspace:
root: ~/notes/native
paths:
- native/node_modules
- run: cd native && ./misc/download_keystore.sh
- run: cd native && node ./misc/config-generator.js
- run: cd native && perl -pi -w -e "s/1.3android/1.3android-c$CIRCLE_BUILD_NUM/g;" android/app/build.gradle
- run: cd native/android && ./gradlew assembleRelease -PMYAPP_RELEASE_STORE_FILE=$MYAPP_RELEASE_STORE_FILE -PMYAPP_RELEASE_KEY_ALIAS=$MYAPP_RELEASE_KEY_ALIAS -PMYAPP_RELEASE_STORE_PASSWORD=$MYAPP_RELEASE_STORE_PASSWORD -PMYAPP_RELEASE_KEY_PASSWORD=$MYAPP_RELEASE_KEY_PASSWORD || exit 0
- run: yes | sdkmanager --licenses || exit 0
- run: cd native/android && ./gradlew assembleRelease -PMYAPP_RELEASE_STORE_FILE=$MYAPP_RELEASE_STORE_FILE -PMYAPP_RELEASE_KEY_ALIAS=$MYAPP_RELEASE_KEY_ALIAS -PMYAPP_RELEASE_STORE_PASSWORD=$MYAPP_RELEASE_STORE_PASSWORD -PMYAPP_RELEASE_KEY_PASSWORD=$MYAPP_RELEASE_KEY_PASSWORD
- run: mkdir -p /tmp/artifacts-android;
- run: cp -r native/android/app/build/outputs/apk/release/app-* /tmp/artifacts-android
- run: cp /tmp/artifacts-android/app-arm64-v8a-release.apk /tmp/artifacts-android/notes-qa-v$CIRCLE_BUILD_NUM-arm64.apk
- run: cp /tmp/artifacts-android/app-armeabi-v7a-release.apk /tmp/artifacts-android/notes-qa-v$CIRCLE_BUILD_NUM-arm.apk
- run: cp /tmp/artifacts-android/app-x86-release.apk /tmp/artifacts-android/notes-qa-v$CIRCLE_BUILD_NUM-x86.apk
- store_artifacts:
path: /tmp/artifacts-android
- save_cache:
key: apk-v1-{{ .Branch }}-{{epoch}}
paths:
- /tmp/artifacts-android/
signapk:
working_directory: ~/notes/native
docker:
- image: circleci/android:api-26-node8-alpha
steps:
- restore_cache:
key: apk-v1-{{ .Branch }}
# arm64
- run:
name: Sign APK arm64
command: |
curl -F "input=@/tmp/artifacts-android/app-arm64-v8a-release.apk" \
-o /tmp/artifacts-android/app-arm64-v8a-release-signed.apk \
-H "Authorization: $AUTOGRAPH_EDGE_TOKEN" \
https://edge.prod.autograph.services.mozaws.net/sign
- run:
name: Verify APK arm64
command: |
sudo apt update
sudo apt install -y android-sdk-build-tools
/opt/android/sdk/build-tools/27.0.3/apksigner verify --verbose /tmp/artifacts-android/app-arm64-v8a-release-signed.apk
# arm
- run:
name: Sign APK arm
command: |
curl -F "input=@/tmp/artifacts-android/app-armeabi-v7a-release.apk" \
-o /tmp/artifacts-android/app-armeabi-v7a-release-signed.apk \
-H "Authorization: $AUTOGRAPH_EDGE_TOKEN" \
https://edge.prod.autograph.services.mozaws.net/sign
- run:
name: Verify APK arm
command: |
sudo apt update
sudo apt install -y android-sdk-build-tools
/opt/android/sdk/build-tools/27.0.3/apksigner verify --verbose /tmp/artifacts-android/app-armeabi-v7a-release-signed.apk
# x86
- run:
name: Sign APK x86
command: |
curl -F "input=@/tmp/artifacts-android/app-x86-release.apk" \
-o /tmp/artifacts-android/app-x86-release-signed.apk \
-H "Authorization: $AUTOGRAPH_EDGE_TOKEN" \
https://edge.prod.autograph.services.mozaws.net/sign
- run:
name: Verify APK x86
command: |
sudo apt update
sudo apt install -y android-sdk-build-tools
/opt/android/sdk/build-tools/27.0.3/apksigner verify --verbose /tmp/artifacts-android/app-x86-release-signed.apk
- store_artifacts:
path: /tmp/artifacts-android
workflows:
version: 2
node-android-signapk:
jobs:
- webextension
- android
- signapk:
requires:
- android
filters:
tags:
only: /android-[0-9]\.[0-9]\.[0-9]/
branches:
only:
- master
- /prepare-.*/ # or regexes