Using EAS update

This commit is contained in:
xmflsct 2022-08-16 22:39:54 +02:00
parent d0bdb08bbe
commit 70c90b6a47
15 changed files with 40 additions and 44 deletions

View File

@ -100,6 +100,7 @@ jobs:
uses: expo/expo-github-action@v7 uses: expo/expo-github-action@v7
with: with:
expo-version: latest expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }} token: ${{ secrets.EXPO_TOKEN }}
- name: -- Step 5 -- Install node dependencies - name: -- Step 5 -- Install node dependencies
run: yarn install run: yarn install
@ -120,3 +121,6 @@ jobs:
GH_PAT_GET_RELEASE: ${{ secrets.GITHUB_TOKEN }} GH_PAT_GET_RELEASE: ${{ secrets.GITHUB_TOKEN }}
FL_GITHUB_RELEASE_API_BEARER: ${{ secrets.GITHUB_TOKEN }} FL_GITHUB_RELEASE_API_BEARER: ${{ secrets.GITHUB_TOKEN }}
run: yarn app:build release run: yarn app:build release
- name: -- Step 8 -- Publish expo update
run: eas update --non-interactive --auto

View File

@ -171,7 +171,7 @@ android {
} }
} }
manifestPlaceholders = [ manifestPlaceholders = [
expoSDK: project.hasProperty('expoSDK') ? project.property('expoSDK') : "", runtimeVersion: project.hasProperty('runtimeVersion') ? project.property('runtimeVersion') : "",
releaseChannel: project.hasProperty('releaseChannel') ? project.property('releaseChannel') : "default" releaseChannel: project.hasProperty('releaseChannel') ? project.property('releaseChannel') : "default"
] ]
} }

View File

@ -13,11 +13,11 @@
<!-- [Custom] Expo Notifications --> <!-- [Custom] Expo Notifications -->
<meta-data android:name="expo.modules.notifications.default_notification_icon" android:resource="@drawable/ic_stat_notifications" /> <meta-data android:name="expo.modules.notifications.default_notification_icon" android:resource="@drawable/ic_stat_notifications" />
<!-- [Custom] End Expo Notifications --> <!-- [Custom] End Expo Notifications -->
<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://exp.host/@xmflsct/tooot"/> <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="https://u.expo.dev/3288313f-3ff0-496a-a5a9-d8985e7cad5f"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="${expoSDK}"/> <meta-data android:name="expo.modules.updates.EXPO_RUNTIME_VERSION" android:value="${runtimeVersion}"/>
<meta-data android:name="expo.modules.updates.EXPO_RELEASE_CHANNEL" android:value="${releaseChannel}"/> <meta-data android:name="expo.modules.updates.EXPO_RELEASE_CHANNEL" android:value="${releaseChannel}"/>
<meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/> <meta-data android:name="expo.modules.updates.ENABLED" android:value="true"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/> <meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="WIFI_ONLY"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/> <meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:exported="true" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait" android:documentLaunchMode="never"> <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:exported="true" android:theme="@style/Theme.App.SplashScreen" android:screenOrientation="portrait" android:documentLaunchMode="never">
<intent-filter> <intent-filter>

View File

@ -5,6 +5,10 @@ import 'dotenv/config'
const toootVersion = `${versions.major}.${versions.minor}.${versions.patch}` const toootVersion = `${versions.major}.${versions.minor}.${versions.patch}`
export default (): ExpoConfig => ({ export default (): ExpoConfig => ({
updates: {
url: "https://u.expo.dev/3288313f-3ff0-496a-a5a9-d8985e7cad5f"
},
runtimeVersion: `${versions.major}.${versions.minor}`,
name: 'tooot', name: 'tooot',
description: 'tooot for Mastodon', description: 'tooot for Mastodon',
slug: 'tooot', slug: 'tooot',

View File

@ -31,8 +31,8 @@ private_lane :build_ios do
IPA_FILE = "#{BUILD_DIRECTORY}/tooot.ipa" IPA_FILE = "#{BUILD_DIRECTORY}/tooot.ipa"
DSYM_FILE = "#{BUILD_DIRECTORY}/tooot.app.dSYM.zip" DSYM_FILE = "#{BUILD_DIRECTORY}/tooot.app.dSYM.zip"
set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesSDKVersion", value: VERSIONS[:expo] ) set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesRuntimeVersion", value: VERSION )
set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesReleaseChannel", value: RELEASE_CHANNEL ) set_info_plist_value( path: EXPO_PLIST, key: "EXUpdatesReleaseChannel", value: ENVIRONMENT )
setup_ci setup_ci
set_info_plist_value( path: INFO_PLIST, key: "CFBundleShortVersionString", value: VERSION ) set_info_plist_value( path: INFO_PLIST, key: "CFBundleShortVersionString", value: VERSION )
@ -97,8 +97,8 @@ private_lane :build_android do
print_command: true, print_command: true,
print_command_output: true, print_command_output: true,
properties: { properties: {
"expoSDK" => VERSIONS[:expo], "runtimeVersion" => VERSION,
"releaseChannel" => RELEASE_CHANNEL, "releaseChannel" => ENVIRONMENT,
"android.injected.signing.store.file" => "#{File.expand_path('..', Dir.pwd)}/android/tooot.jks", "android.injected.signing.store.file" => "#{File.expand_path('..', Dir.pwd)}/android/tooot.jks",
"android.injected.signing.store.password" => ENV["ANDROID_KEYSTORE_PASSWORD"], "android.injected.signing.store.password" => ENV["ANDROID_KEYSTORE_PASSWORD"],
"android.injected.signing.key.alias" => ENV["ANDROID_KEYSTORE_ALIAS"], "android.injected.signing.key.alias" => ENV["ANDROID_KEYSTORE_ALIAS"],
@ -136,8 +136,8 @@ private_lane :build_android_apk do
print_command: true, print_command: true,
print_command_output: true, print_command_output: true,
properties: { properties: {
"expoSDK" => VERSIONS[:expo], "runtimeVersion" => VERSION,
"releaseChannel" => RELEASE_CHANNEL, "releaseChannel" => ENVIRONMENT,
"android.injected.signing.store.file" => "#{File.expand_path('..', Dir.pwd)}/android/tooot.jks", "android.injected.signing.store.file" => "#{File.expand_path('..', Dir.pwd)}/android/tooot.jks",
"android.injected.signing.store.password" => ENV["ANDROID_KEYSTORE_PASSWORD"], "android.injected.signing.store.password" => ENV["ANDROID_KEYSTORE_PASSWORD"],
"android.injected.signing.key.alias" => ENV["ANDROID_KEYSTORE_ALIAS"], "android.injected.signing.key.alias" => ENV["ANDROID_KEYSTORE_ALIAS"],
@ -185,6 +185,5 @@ lane :release do
upload_assets: ["#{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"] upload_assets: ["#{File.expand_path('..', Dir.pwd)}/tooot-#{GITHUB_RELEASE}.apk"]
) )
end end
yarn( package_path: "./package.json", flags: "release", command: RELEASE_CHANNEL )
rocket rocket
end end

View File

@ -9,10 +9,10 @@
<key>EXUpdatesLaunchWaitMs</key> <key>EXUpdatesLaunchWaitMs</key>
<integer>0</integer> <integer>0</integer>
<key>EXUpdatesReleaseChannel</key> <key>EXUpdatesReleaseChannel</key>
<string>0-development</string> <string>development</string>
<key>EXUpdatesSDKVersion</key> <key>EXUpdatesRuntimeVersion</key>
<string>0</string> <string>0</string>
<key>EXUpdatesURL</key> <key>EXUpdatesURL</key>
<string>https://exp.host/@xmflsct/tooot</string> <string>https://u.expo.dev/3288313f-3ff0-496a-a5a9-d8985e7cad5f</string>
</dict> </dict>
</plist> </plist>

View File

@ -1,11 +1,9 @@
{ {
"name": "tooot", "name": "tooot",
"versions": { "versions": {
"native": "220806",
"major": 4, "major": 4,
"minor": 2, "minor": 2,
"patch": 0, "patch": 0
"expo": "46.0.0"
}, },
"description": "tooot app for Mastodon", "description": "tooot app for Mastodon",
"author": "xmflsct <me@xmflsct.com>", "author": "xmflsct <me@xmflsct.com>",
@ -20,7 +18,6 @@
"iphone": "react-native run-ios", "iphone": "react-native run-ios",
"ipad": "react-native run-ios --simulator 'iPad mini (6th generation)'", "ipad": "react-native run-ios --simulator 'iPad mini (6th generation)'",
"app:build": "bundle exec fastlane", "app:build": "bundle exec fastlane",
"release": "scripts/release.sh",
"clean": "react-native-clean-project", "clean": "react-native-clean-project",
"postinstall": "patch-package" "postinstall": "patch-package"
}, },
@ -149,4 +146,4 @@
} }
} }
} }
} }

View File

@ -1,8 +0,0 @@
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Arguments incorrect"
exit 1
fi
expo publish --quiet --target bare --release-channel=$1

View File

@ -23,13 +23,13 @@ const apiGeneral = async <T = unknown>({
}: Params): Promise<{ body: T }> => { }: Params): Promise<{ body: T }> => {
console.log( console.log(
ctx.bgGreen.bold(' API general ') + ctx.bgGreen.bold(' API general ') +
' ' + ' ' +
domain + domain +
' ' + ' ' +
method + method +
ctx.green(' -> ') + ctx.green(' -> ') +
`/${url}` + `/${url}` +
(params ? ctx.green(' -> ') : ''), (params ? ctx.green(' -> ') : ''),
params ? params : '' params ? params : ''
) )
@ -44,7 +44,7 @@ const apiGeneral = async <T = unknown>({
body && body instanceof FormData body && body instanceof FormData
? 'multipart/form-data' ? 'multipart/form-data'
: 'application/json', : 'application/json',
'User-Agent': `tooot/${Constants.manifest?.version}`, 'User-Agent': `tooot/${Constants.expoConfig?.version}`,
Accept: '*/*', Accept: '*/*',
...headers ...headers
}, },

View File

@ -74,7 +74,7 @@ const apiInstance = async <T = unknown>({
body && body instanceof FormData body && body instanceof FormData
? 'multipart/form-data' ? 'multipart/form-data'
: 'application/json', : 'application/json',
'User-Agent': `tooot/${Constants.manifest?.version}`, 'User-Agent': `tooot/${Constants.expoConfig?.version}`,
Accept: '*/*', Accept: '*/*',
...headers, ...headers,
...(token && { ...(token && {

View File

@ -50,7 +50,7 @@ const apiTooot = async <T = unknown>({
body && body instanceof FormData body && body instanceof FormData
? 'multipart/form-data' ? 'multipart/form-data'
: 'application/json', : 'application/json',
'User-Agent': `tooot/${Constants.manifest?.version}`, 'User-Agent': `tooot/${Constants.expoConfig?.version}`,
Accept: '*/*', Accept: '*/*',
...headers ...headers
}, },

View File

@ -42,7 +42,7 @@ const SettingsAnalytics: React.FC = () => {
color: colors.secondary color: colors.secondary
}} }}
> >
{t('me.settings.version', { version: Constants.manifest?.version })} {t('me.settings.version', { version: Constants.expoConfig?.version })}
</CustomText> </CustomText>
<CustomText <CustomText
fontStyle='S' fontStyle='S'

View File

@ -36,14 +36,14 @@ const mapEnvironment = <T = unknown>({
const isDevelopment = const isDevelopment =
__DEV__ || __DEV__ ||
['development'].some(channel => Updates.releaseChannel.includes(channel)) ['development'].some(channel => Updates.channel === channel)
const isCandidate = ['candidate'].some(channel => const isCandidate = ['candidate'].some(channel =>
Updates.releaseChannel.includes(channel) Updates.channel === channel
) )
const isRelease = ['release'].some(channel => const isRelease = ['release'].some(channel =>
Updates.releaseChannel.includes(channel) Updates.channel === channel
) )
export { mapEnvironment, isDevelopment, isCandidate, isRelease } export { mapEnvironment, isDevelopment, isCandidate, isRelease }

View File

@ -54,9 +54,9 @@ const appSlice = createSlice({
} }
}) })
.addCase(retriveVersionLatest.fulfilled, (state, action) => { .addCase(retriveVersionLatest.fulfilled, (state, action) => {
if (action.payload && Constants.manifest?.version) { if (action.payload && Constants.expoConfig?.version) {
if ( if (
parseFloat(action.payload) > parseFloat(Constants.manifest.version) parseFloat(action.payload) > parseFloat(Constants.expoConfig?.version)
) { ) {
state.versionUpdate = true state.versionUpdate = true
} }

View File

@ -38,7 +38,7 @@ const contextsSlice = createSlice({
initialState: contextsInitialState as ContextsState, initialState: contextsInitialState as ContextsState,
reducers: { reducers: {
updateStoreReview: (state, action: PayloadAction<1>) => { updateStoreReview: (state, action: PayloadAction<1>) => {
if (Updates.releaseChannel.includes('release')) { if (Updates.channel === 'release') {
state.storeReview.current = state.storeReview.current + action.payload state.storeReview.current = state.storeReview.current + action.payload
if (state.storeReview.current === state.storeReview.context) { if (state.storeReview.current === state.storeReview.context) {
StoreReview?.isAvailableAsync().then(() => StoreReview?.isAvailableAsync().then(() =>