-
Notifications
You must be signed in to change notification settings - Fork 2.1k
161 lines (140 loc) Β· 5.09 KB
/
Copy pathbuild-android.yml
File metadata and controls
161 lines (140 loc) Β· 5.09 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: π€ Build Android
on:
push:
branches:
- "**"
paths:
- "apps/mobile/**"
- "pnpm-lock.yaml"
workflow_dispatch:
inputs:
profile:
type: choice
default: preview
options:
- preview
- production-apk
- production
description: "Build profile"
release:
type: boolean
default: false
description: "Create a release draft for the build"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.profile }}
cancel-in-progress: true
jobs:
build:
name: Build Android apk for device
if: >-
github.secret_source != 'None' &&
(
github.event_name != 'push' ||
!(
(github.ref == 'refs/heads/mobile-main' && contains(github.event.head_commit.message || '', 'release(mobile):')) ||
(github.ref == 'refs/heads/main' && contains(github.event.head_commit.message || '', 'release(desktop):'))
)
)
runs-on: ubuntu-latest
steps:
- name: π§Ή Claim disk space
run: |
df -h /
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/.ghcup
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/julia*
df -h /
- name: π¦ Checkout code
uses: actions/checkout@v7
- name: π¦ Setup pnpm
uses: pnpm/action-setup@v6
- name: π Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 22
cache: "pnpm"
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: "17"
distribution: "zulu"
- name: Setup Android SDK
uses: android-actions/setup-android@v4
- name: π± Setup EAS
uses: expo/expo-github-action@v9
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Install dependencies
run: pnpm install --frozen-lockfile --child-concurrency=1
- name: Build mobile web assets
run: pnpm --dir apps/mobile/web-app build --outDir ../../../out/rn-web/html-renderer
- name: Validate release profile
if: github.event.inputs.release == 'true'
run: |
profile="${{ github.event.inputs.profile || 'preview' }}"
if [ "$profile" != "production-apk" ]; then
echo "GitHub Release APKs must use the production-apk profile."
exit 1
fi
- name: π¨ Build Android app
working-directory: apps/mobile
run: eas build --platform android --profile ${{ github.event.inputs.profile || 'preview' }} --local --output=${{ github.workspace }}/build.${{ github.event.inputs.profile == 'production' && 'aab' || 'apk' }}
env:
EAS_BUILD_DISABLE_EXPO_DOCTOR_STEP: "1"
EAS_NO_FROZEN_LOCKFILE: "1"
npm_config_node_linker: isolated
npm_config_shamefully_hoist: "false"
- name: π€ Upload apk Artifact
if: github.event.inputs.profile != 'production'
uses: actions/upload-artifact@v7
with:
name: app-android
path: ${{ github.workspace }}/build.apk
retention-days: 90
- name: π€ Upload aab Artifact
if: github.event.inputs.profile == 'production'
uses: actions/upload-artifact@v7
with:
name: aab-android
path: ${{ github.workspace }}/build.aab
retention-days: 90
- name: Submit to Google Play
if: github.event.inputs.profile == 'production'
working-directory: apps/mobile
run: eas submit --platform android --path ${{ github.workspace }}/build.aab --non-interactive
- name: Setup Version
if: github.event.inputs.release == 'true'
id: version
uses: ./.github/actions/setup-version
with:
type: "mobile"
- name: Prepare Release Notes
if: github.event.inputs.release == 'true'
id: release_notes
run: |
version="${{ steps.version.outputs.APP_VERSION }}"
changelog_file="apps/mobile/changelog/${version}.md"
release_notes_file="$RUNNER_TEMP/mobile-release-notes.md"
if [ -f "$changelog_file" ]; then
cp "$changelog_file" "$release_notes_file"
else
{
echo "# What's New in v${version}"
echo
echo "- No changelog file found at ${changelog_file}."
} > "$release_notes_file"
fi
echo "body_path=${release_notes_file}" >> "$GITHUB_OUTPUT"
- name: Create Release Draft
if: github.event.inputs.release == 'true'
uses: softprops/action-gh-release@v3
with:
name: Mobile v${{ steps.version.outputs.APP_VERSION }}
draft: true
prerelease: true
tag_name: mobile/v${{ steps.version.outputs.APP_VERSION }}
body_path: ${{ steps.release_notes.outputs.body_path }}
files: ${{ format('{0}/build.{1}', github.workspace, github.event.inputs.profile == 'production' && 'aab' || 'apk') }}