add bundle identifiers to app-info (#3861)

* add bundle identifiers to `app-info`

* add them to the `.env.example`

* add environment variables for docker build

* add environment variables for native builds and bundles

* also include the hour in bundle date

* organize app info better in settings
zio/stable
Hailey 2024-05-04 16:33:10 -07:00 committed by GitHub
parent eb55bdf172
commit 4862bc2ba8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 53 additions and 23 deletions

View File

@ -4,3 +4,5 @@ SENTRY_AUTH_TOKEN=
EXPO_PUBLIC_ENV=development EXPO_PUBLIC_ENV=development
EXPO_PUBLIC_LOG_LEVEL=debug EXPO_PUBLIC_LOG_LEVEL=debug
EXPO_PUBLIC_LOG_DEBUG= EXPO_PUBLIC_LOG_DEBUG=
EXPO_PUBLIC_BUNDLE_IDENTIFIER=
EXPO_PUBLIC_BUNDLE_DATE=0

View File

@ -1,9 +1,9 @@
name: build-and-push-bskyweb-aws name: build-and-push-bskyweb-aws
on: on:
workflow_dispatch:
push: push:
branches: branches:
- main - main
- 3p-moderators
env: env:
REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }} REGISTRY: ${{ secrets.AWS_ECR_REGISTRY_USEAST2_PACKAGES_REGISTRY }}
@ -54,3 +54,6 @@ jobs:
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
env:
EXPO_PUBLIC_BUNDLE_IDENTIFIER: $(git rev-parse --short HEAD)
EXPO_PUBLIC_BUNDLE_DATE: $(date -u +"%y%m%d%H")

View File

@ -57,6 +57,8 @@ jobs:
run: | run: |
export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}' export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}'
echo "${{ secrets.ENV_TOKEN }}" > .env echo "${{ secrets.ENV_TOKEN }}" > .env
echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse --short HEAD)" >> .env
echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env
echo "$json" > google-services.json echo "$json" > google-services.json
- name: 🏗️ EAS Build - name: 🏗️ EAS Build

View File

@ -65,6 +65,8 @@ jobs:
- name: ✏️ Write environment variables - name: ✏️ Write environment variables
run: | run: |
echo "${{ secrets.ENV_TOKEN }}" > .env echo "${{ secrets.ENV_TOKEN }}" > .env
echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse --short HEAD)" >> .env
echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env
echo "${{ secrets.GOOGLE_SERVICES_TOKEN }}" > google-services.json echo "${{ secrets.GOOGLE_SERVICES_TOKEN }}" > google-services.json
- name: 🏗️ EAS Build - name: 🏗️ EAS Build

View File

@ -144,6 +144,8 @@ jobs:
run: | run: |
export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}' export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}'
echo "${{ secrets.ENV_TOKEN }}" > .env echo "${{ secrets.ENV_TOKEN }}" > .env
echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse --short HEAD)" >> .env
echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env
echo "$json" > google-services.json echo "$json" > google-services.json
- name: 🏗️ Create Bundle - name: 🏗️ Create Bundle
@ -222,6 +224,8 @@ jobs:
- name: ✏️ Write environment variables - name: ✏️ Write environment variables
run: | run: |
echo "${{ secrets.ENV_TOKEN }}" > .env echo "${{ secrets.ENV_TOKEN }}" > .env
echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse --short HEAD)" >> .env
echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env
echo "${{ secrets.GOOGLE_SERVICES_TOKEN }}" > google-services.json echo "${{ secrets.GOOGLE_SERVICES_TOKEN }}" > google-services.json
- name: 🏗️ EAS Build - name: 🏗️ EAS Build
@ -283,6 +287,8 @@ jobs:
run: | run: |
export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}' export json='${{ secrets.GOOGLE_SERVICES_TOKEN }}'
echo "${{ secrets.ENV_TOKEN }}" > .env echo "${{ secrets.ENV_TOKEN }}" > .env
echo "EXPO_PUBLIC_BUNDLE_IDENTIFIER=$(git rev-parse --short HEAD)" >> .env
echo "EXPO_PUBLIC_BUNDLE_DATE=$(date -u +"%y%m%d%H")" >> .env
echo "$json" > google-services.json echo "$json" > google-services.json
- name: 🏗️ EAS Build - name: 🏗️ EAS Build

View File

@ -4,7 +4,16 @@ export const BUILD_ENV = process.env.EXPO_PUBLIC_ENV
export const IS_DEV = process.env.EXPO_PUBLIC_ENV === 'development' export const IS_DEV = process.env.EXPO_PUBLIC_ENV === 'development'
export const IS_TESTFLIGHT = process.env.EXPO_PUBLIC_ENV === 'testflight' export const IS_TESTFLIGHT = process.env.EXPO_PUBLIC_ENV === 'testflight'
const UPDATES_CHANNEL = IS_TESTFLIGHT ? 'testflight' : 'production' // This is the commit hash that the current bundle was made from. The user can see the commit hash in the app's settings
export const appVersion = `${nativeApplicationVersion} (${nativeBuildVersion}, ${ // along with the other version info. Useful for debugging/reporting.
IS_DEV ? 'development' : UPDATES_CHANNEL export const BUNDLE_IDENTIFIER = process.env.EXPO_PUBLIC_COMMIT_HASH ?? 'dev'
// This will always be in the format of YYMMDD, so that it always increases for each build. This should only be used
// for Statsig reporting and shouldn't be used to identify a specific bundle.
export const BUNDLE_DATE =
IS_TESTFLIGHT || IS_DEV ? 0 : Number(process.env.EXPO_PUBLIC_BUNDLE_DATE)
export const appVersion = `${nativeApplicationVersion}.${nativeBuildVersion}`
export const bundleInfo = `${BUNDLE_IDENTIFIER} (${
IS_DEV ? 'dev' : IS_TESTFLIGHT ? 'tf' : 'prod'
})` })`

View File

@ -1,2 +1,16 @@
import {version} from '../../package.json' import {version} from '../../package.json'
export const IS_DEV = process.env.EXPO_PUBLIC_ENV === 'development'
// This is the commit hash that the current bundle was made from. The user can see the commit hash in the app's settings
// along with the other version info. Useful for debugging/reporting.
export const BUNDLE_IDENTIFIER = process.env.EXPO_PUBLIC_COMMIT_HASH ?? 'dev'
// This will always be in the format of YYMMDD, so that it always increases for each build. This should only be used
// for Statsig reporting and shouldn't be used to identify a specific bundle.
export const BUNDLE_DATE = IS_DEV
? 0
: Number(process.env.EXPO_PUBLIC_BUNDLE_DATE)
export const appVersion = version export const appVersion = version
export const bundleInfo = `${BUNDLE_IDENTIFIER} (${IS_DEV ? 'dev' : 'prod'})`

View File

@ -1,6 +1,5 @@
import React from 'react' import React from 'react'
import { import {
Linking,
Platform, Platform,
Pressable, Pressable,
StyleSheet, StyleSheet,
@ -40,7 +39,7 @@ import {
import {useLoggedOutViewControls} from '#/state/shell/logged-out' import {useLoggedOutViewControls} from '#/state/shell/logged-out'
import {useCloseAllActiveElements} from '#/state/util' import {useCloseAllActiveElements} from '#/state/util'
import {useAnalytics} from 'lib/analytics/analytics' import {useAnalytics} from 'lib/analytics/analytics'
import * as AppInfo from 'lib/app-info' import {appVersion, BUNDLE_DATE, bundleInfo} from 'lib/app-info'
import {STATUS_PAGE_URL} from 'lib/constants' import {STATUS_PAGE_URL} from 'lib/constants'
import {useAccountSwitcher} from 'lib/hooks/useAccountSwitcher' import {useAccountSwitcher} from 'lib/hooks/useAccountSwitcher'
import {useCustomPalette} from 'lib/hooks/useCustomPalette' import {useCustomPalette} from 'lib/hooks/useCustomPalette'
@ -256,7 +255,7 @@ export function SettingsScreen({}: Props) {
const onPressBuildInfo = React.useCallback(() => { const onPressBuildInfo = React.useCallback(() => {
setStringAsync( setStringAsync(
`Build version: ${AppInfo.appVersion}; Platform: ${Platform.OS}`, `Build version: ${appVersion}; Bundle info: ${bundleInfo}; Bundle date: ${BUNDLE_DATE}; Platform: ${Platform.OS}`,
) )
Toast.show(_(msg`Copied build version to clipboard`)) Toast.show(_(msg`Copied build version to clipboard`))
}, [_]) }, [_])
@ -293,10 +292,6 @@ export function SettingsScreen({}: Props) {
navigation.navigate('AccessibilitySettings') navigation.navigate('AccessibilitySettings')
}, [navigation]) }, [navigation])
const onPressStatusPage = React.useCallback(() => {
Linking.openURL(STATUS_PAGE_URL)
}, [])
const onPressBirthday = React.useCallback(() => { const onPressBirthday = React.useCallback(() => {
birthdayControl.open() birthdayControl.open()
}, [birthdayControl]) }, [birthdayControl])
@ -870,17 +865,9 @@ export function SettingsScreen({}: Props) {
accessibilityRole="button" accessibilityRole="button"
onPress={onPressBuildInfo}> onPress={onPressBuildInfo}>
<Text type="sm" style={[styles.buildInfo, pal.textLight]}> <Text type="sm" style={[styles.buildInfo, pal.textLight]}>
<Trans>Version {AppInfo.appVersion}</Trans> <Trans>
</Text> Version {appVersion} {bundleInfo}
</TouchableOpacity> </Trans>
<Text type="sm" style={[pal.textLight]}>
&nbsp; &middot; &nbsp;
</Text>
<TouchableOpacity
accessibilityRole="button"
onPress={onPressStatusPage}>
<Text type="sm" style={[styles.buildInfo, pal.textLight]}>
<Trans>Status page</Trans>
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View> </View>
@ -902,6 +889,12 @@ export function SettingsScreen({}: Props) {
href="https://bsky.social/about/support/privacy-policy" href="https://bsky.social/about/support/privacy-policy"
text={_(msg`Privacy Policy`)} text={_(msg`Privacy Policy`)}
/> />
<TextLink
type="md"
style={pal.link}
href={STATUS_PAGE_URL}
text={_(msg`Status Page`)}
/>
</View> </View>
<View style={s.footerSpacer} /> <View style={s.footerSpacer} />
</ScrollView> </ScrollView>
@ -1047,7 +1040,6 @@ const styles = StyleSheet.create({
footer: { footer: {
flex: 1, flex: 1,
flexDirection: 'row', flexDirection: 'row',
alignItems: 'center',
paddingLeft: 18, paddingLeft: 18,
}, },
}) })