-
Notifications
You must be signed in to change notification settings - Fork 509
142 lines (122 loc) · 4.99 KB
/
Copy pathnightly-apk.yml
File metadata and controls
142 lines (122 loc) · 4.99 KB
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
name: Build Nightly APK
on:
schedule:
# Runs at 02:17 America/Buenos_Aires.
- cron: '17 5 * * *'
workflow_dispatch:
permissions:
actions: read
contents: read
concurrency:
group: nightly-apk-${{ github.ref }}
cancel-in-progress: false
jobs:
changes:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
outputs:
current-sha: ${{ steps.nightly-changes.outputs.current-sha }}
previous-sha: ${{ steps.nightly-changes.outputs.previous-sha }}
should-build: ${{ steps.nightly-changes.outputs.should-build }}
short-sha: ${{ steps.nightly-changes.outputs.short-sha }}
steps:
- name: Check for new master changes
id: nightly-changes
uses: actions/github-script@v9
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const workflow_id = 'nightly-apk.yml';
const currentSha = context.sha;
const shortSha = currentSha.slice(0, 7);
if (context.eventName === 'workflow_dispatch') {
core.setOutput('current-sha', currentSha);
core.setOutput('previous-sha', '');
core.setOutput('short-sha', shortSha);
core.setOutput('should-build', 'true');
await core.summary
.addHeading('Nightly APK')
.addRaw(`Manual run requested for ${currentSha}. Building APKs.`)
.write();
return;
}
const runs = await github.paginate(github.rest.actions.listWorkflowRuns, {
owner,
repo,
workflow_id,
branch: 'master',
status: 'success',
per_page: 20,
});
const previousRun = runs.find((run) => run.id !== context.runId);
const previousSha = previousRun?.head_sha ?? '';
const shouldBuild = previousSha !== currentSha;
core.setOutput('current-sha', currentSha);
core.setOutput('previous-sha', previousSha);
core.setOutput('short-sha', shortSha);
core.setOutput('should-build', shouldBuild ? 'true' : 'false');
const summary = core.summary.addHeading('Nightly APK');
if (shouldBuild) {
summary.addRaw(
previousSha
? `master moved from ${previousSha} to ${currentSha}. Building APKs.`
: `No previous successful nightly was found. Building APKs for ${currentSha}.`
);
} else {
summary.addRaw(`master is still at ${currentSha}. Skipping APK build.`);
}
await summary.write();
build:
needs: changes
if: needs.changes.outputs.should-build == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Cache nightly keystore
id: cache-keystore
uses: actions/cache@v6
with:
path: vz-pixelplay.jks
key: ${{ runner.os }}-nightly-keystore-vz-pixelplay
- name: Generate nightly keystore if not cached
if: steps.cache-keystore.outputs.cache-hit != 'true'
run: |
keytool -genkey -v -keystore vz-pixelplay.jks -alias pixelplay-nightly-key -keyalg RSA -keysize 4096 -validity 10000 \
-storepass 994273 -keypass 994273 \
-dname "CN=PixelPlay Nightly, OU=Dev, O=PixelPlay, L=World, S=World, C=US"
- name: Create keystore.properties
run: |
echo "storePassword=994273" > keystore.properties
echo "keyAlias=pixelplay-nightly-key" >> keystore.properties
echo "keyPassword=994273" >> keystore.properties
- name: Build Phone nightly release APKs
run: gradle :app:assembleRelease -Ppixelplay.enableAbiSplits=true --no-build-cache
- name: Verify Phone nightly split APKs
run: |
BUILD_TOOLS_VERSION="$(ls "$ANDROID_HOME/build-tools" | sort -V | tail -n 1)"
for apk in \
app/build/outputs/apk/release/app-arm64-v8a-release.apk \
app/build/outputs/apk/release/app-armeabi-v7a-release.apk
do
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/aapt2" dump badging "$apk" >/dev/null
"$ANDROID_HOME/build-tools/$BUILD_TOOLS_VERSION/apksigner" verify --verbose "$apk"
done
- name: Upload Phone nightly split APK artifacts
uses: actions/upload-artifact@v7.0.1
with:
name: PixelPlay-phone-nightly-${{ needs.changes.outputs.short-sha }}
path: |
app/build/outputs/apk/release/app-arm64-v8a-release.apk
app/build/outputs/apk/release/app-armeabi-v7a-release.apk
if-no-files-found: error
compression-level: 0
retention-days: 14