forked from
jollywhoppers.com/witchsky.app
Bluesky app fork with some witchin' additions 💫
1---
2name: Build and Submit Android
3
4on:
5 workflow_dispatch:
6 inputs:
7 profile:
8 type: choice
9 description: Build profile to use
10 options:
11 - testflight-android
12 - production
13
14jobs:
15 build:
16 if: github.repository == 'bluesky-social/social-app'
17 name: Build and Submit Android
18 runs-on: Linux-x64-32core
19 concurrency:
20 group: android-build
21 cancel-in-progress: false
22 steps:
23 - name: Check for EXPO_TOKEN
24 run: >
25 if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
26 echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
27 exit 1
28 fi
29
30 - name: ⬇️ Checkout
31 uses: actions/checkout@v4
32 with:
33 fetch-depth: 5
34
35 - name: 🔧 Setup Node
36 uses: actions/setup-node@v6
37 with:
38 node-version-file: .nvmrc
39 cache: yarn
40
41 - name: 🪛 Setup jq
42 uses: dcarbone/install-jq-action@v2
43
44 - name: 🔨 Setup EAS
45 uses: expo/expo-github-action@main
46 with:
47 expo-version: latest
48 eas-version: latest
49 token: ${{ secrets.EXPO_TOKEN }}
50
51 - name: ⛏️ Setup EAS local builds
52 run: yarn global add eas-cli-local-build-plugin
53
54 - uses: actions/setup-java@v4
55 with:
56 distribution: "temurin"
57 java-version: "17"
58
59 - name: ⚙️ Install dependencies
60 run: yarn install --frozen-lockfile
61
62 - name: 🔤 Compile translations
63 run: yarn intl:build 2>&1 | tee i18n.log
64
65 - name: Check for i18n compilation errors
66 run: if grep -q "invalid syntax" "i18n.log"; then echo "\n\nFound compilation errors!\n\n" && exit 1; else echo "\n\nNo compilation errors!\n\n"; fi
67
68 # EXPO_PUBLIC_ENV is handled in eas.json
69 - name: Env
70 id: env
71 run: |
72 export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}'
73 echo "${{ secrets.ENV_TOKEN }}" > .env
74 echo "EXPO_PUBLIC_RELEASE_VERSION=$(jq -r '.version' package.json)" >> .env
75 echo "EXPO_PUBLIC_RELEASE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
76 echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse HEAD)" >> .env
77 echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
78 echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env
79 echo "EXPO_PUBLIC_SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> .env
80 echo "EXPO_PUBLIC_BITDRIFT_API_KEY=${{ secrets.BITDRIFT_API_KEY }}" >> .env
81 echo "EXPO_PUBLIC_GCP_PROJECT_ID=${{ secrets.EXPO_PUBLIC_GCP_PROJECT_ID }}" >> .env
82 echo "$json" > google-services.json
83
84 - name: 🏗️ EAS Build
85 env:
86 PROFILE: ${{ inputs.profile || 'testflight-android' }}
87 run: >
88 SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
89 SENTRY_RELEASE=${{ steps.env.outputs.EXPO_PUBLIC_RELEASE_VERSION }}
90 SENTRY_DIST=${{ steps.env.outputs.EXPO_PUBLIC_BUNDLE_IDENTIFIER }}
91 yarn use-build-number-with-bump
92 eas build -p android
93 --profile $PROFILE
94 --local --output build.aab --non-interactive
95
96 - name: ✍️ Rename Testflight bundle
97 if: ${{ inputs.profile != 'production' }}
98 run: mv build.aab build.apk
99
100 - name: ⏰ Get a timestamp
101 id: timestamp
102 uses: nanzm/get-time-action@master
103 with:
104 format: "MM-DD-HH-mm-ss"
105
106 - name: 🚀 Upload Production Artifact
107 id: upload-artifact-production
108 if: ${{ inputs.profile == 'production' }}
109 uses: actions/upload-artifact@v4
110 with:
111 retention-days: 30
112 compression-level: 6
113 name: build-${{ steps.timestamp.outputs.time }}.aab
114 path: build.aab
115
116 - name: 🚀 Upload Testflight Artifact
117 id: upload-artifact-testflight
118 if: ${{ inputs.profile != 'production' }}
119 uses: actions/upload-artifact@v4
120 with:
121 retention-days: 30
122 compression-level: 6
123 name: build-${{ steps.timestamp.outputs.time }}.apk
124 path: build.apk
125
126 - name: 📚 Get version from package.json
127 id: get-build-info
128 run: bash scripts/setGitHubOutput.sh
129
130 - name: 🔔 Notify Slack of Production Build
131 if: ${{ inputs.profile == 'production' }}
132 uses: slackapi/slack-github-action@v1.25.0
133 with:
134 payload: |
135 {
136 "text": "Android production build for Google Play Store submission is ready!\n```Artifact: ${{ steps.upload-artifact-production.outputs.artifact-url }}\nVersion Number: ${{ steps.get-build-info.outputs.PACKAGE_VERSION }}\nBuild Number: ${{ steps.get-build-info.outputs.BSKY_ANDROID_VERSION_CODE }}```"
137 }
138 env:
139 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }}
140 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
141
142 - name: 🔔 Notify Slack of Testflight Build
143 if: ${{ inputs.profile != 'production' }}
144 uses: slackapi/slack-github-action@v1.25.0
145 with:
146 payload: |
147 {
148 "text": "Android build is ready for testing. Download the artifact here: ${{ steps.upload-artifact-testflight.outputs.artifact-url }}"
149 }
150 env:
151 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }}
152 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
153
154 - name: 🧹 Clear Metro cache
155 if: ${{ inputs.profile == 'production' }}
156 # https://github.com/expo/eas-cli/issues/2959#issuecomment-2749791326
157 run: rm -rf ${TMPDIR:-/tmp}/metro-cache
158
159 - name: 🏗️ Build Production APK
160 if: ${{ inputs.profile == 'production' }}
161 run: >
162 SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
163 SENTRY_RELEASE=${{ steps.env.outputs.EXPO_PUBLIC_RELEASE_VERSION }}
164 SENTRY_DIST=${{ steps.env.outputs.EXPO_PUBLIC_BUNDLE_IDENTIFIER }}
165 yarn use-build-number-with-bump
166 eas build -p android
167 --profile production-apk
168 --local --output build.apk --non-interactive
169
170 - name: 🚀 Upload Production APK Artifact
171 id: upload-artifact-production-apk
172 if: ${{ inputs.profile == 'production' }}
173 uses: actions/upload-artifact@v4
174 with:
175 retention-days: 30
176 compression-level: 6
177 name: build-${{ steps.timestamp.outputs.time }}.apk
178 path: build.apk
179
180 - name: 🔔 Notify Slack of Production APK Build
181 if: ${{ inputs.profile == 'production' }}
182 uses: slackapi/slack-github-action@v1.25.0
183 with:
184 payload: |
185 {
186 "text": "Android production build for GitHub/Obtanium is ready!\n```Artifact: ${{ steps.upload-artifact-production-apk.outputs.artifact-url }}\nVersion Number: ${{ steps.get-build-info.outputs.PACKAGE_VERSION }}\nBuild Number: ${{ steps.get-build-info.outputs.BSKY_ANDROID_VERSION_CODE }}```"
187 }
188 env:
189 SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLIENT_ALERT_WEBHOOK }}
190 SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
191
192 - name: ⬇️ Restore Cache
193 id: get-base-commit
194 uses: actions/cache@v4
195 if: ${{ inputs.profile == 'testflight-android' }}
196 with:
197 path: most-recent-testflight-commit.txt
198 key: most-recent-testflight-commit
199
200 - name: ✏️ Write commit hash to cache
201 if: ${{ inputs.profile == 'testflight-android' }}
202 env:
203 GITHUB_SHA: ${{ github.sha }}
204 run: echo $GITHUB_SHA > most-recent-testflight-commit.txt