I build and submit my Expo app via this command:
eas build --profile preview --auto-submit --platform all
Like mentioned in the Eas submit docs, I provided appleId, appleTeamId and ascAppId to my eas.json like this:
{
"cli": {
"version": ">= 1.0.0",
"promptToConfigurePushNotifications": false
},
"build": {
...
},
"submit": {
"preview": {
"android": {
...
},
"ios": {
"appleId": "[myAppleId]",
"appleTeamId": "[myAppleTeamId]",
"ascAppId": "[myAscAppId]"
}
}
}
}
So, theoretically submit should be completely autonomous. But I am always requested by the CLI to
"Log in to your Apple Developer account to continue". The credentials are prefilled, but I need to hit 'y' two times, which means the command can not run in CI.
What am I missing here?
Have you already submitted at least one version to the app store?
If not, you'll have to manually submit one first.
Otherwise here you'll probably just need to have 2 env variables set for the eas submit command:
EXPO_APPLE_PASSWORD: the password of the Apple account myAppleId
EXPO_APPLE_APP_SPECIFIC_PASSWORD: a password for the specific app you are submitting (See here on how to set this up)
You'll also need the --non-interactive flag for eas submit
Main doc here https://docs.expo.dev/submit/ios/
Related
My EAS IOS development build is failing, because EAS tries to use the wrong provisioning profile.
I created a new device and certificate mobile provisioning profile on the Apple development sites, set the profile in my Gymfile, and credentials.json, using KeyChain Access.
I used "was credentials" to upload the credential files to EAS.
but when I run
was build --platform ios --profile development --local
Expo always logs into the Apple Dev portal and either creates a new provisioning profile or uses the last one it created which doesn't match what I have set up in credentials.json or the Gymfile.
{
"ios": {
"distributionCertificate": {
"path": "credentials/iOS/xxxx.p12",
"password": "xxxx"
},
"provisioningProfilePath": "credentials/iOS/xxxx.mobileprovision"
}
}
Gymfile
suppress_xcode_output(false)
clean(false)
disable_xcpretty(false)
output_directory("./app_builds")
sdk("iphoneos")
export_method("development")
xcargs("CODE_SIGN_STYLE=Manual")
export_options( provisioningProfiles: { "com.xxxx.yyyy" => "com.xxx.yyyy zzzz" },signingStyle: "manual")
codesigning_identity("Apple Development: qqqqq")
eas.json
"cli": {
"version": ">= 0.38.1"
},
"build": {
"development": {
"ios": {"image": "latest"},
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal",
"developmentClient": true,
"android": {
"buildType": "apk"
}
},
"production": {}
},
"submit": {
"production": {}
}
}
Where the 'xxxx' etc are my redacted credentials names
We've created a webview app and we are using Expo RN. We have done EAS Build -p ios & EAS Submit -p ios.
We have then submitted it to the app store and it is now live on the app store.
But when we make a change with the app, and run Expo Publish, the app doesn't update. I've read so many docs but I'm struggling to see what I've missed.
Any help would be great!
Eas.json
{
"cli": {
"version": ">= 0.41.1"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal"
},
"preview": {
"distribution": "internal"
},
"production": {}
},
"submit": {
"production": {}
}
}
I've followed the instructions to set up CodePush properly. First, I push to AppCenter:
$ appcenter codepush release-react -a myUser/appName -d Production
Detecting ios app version:
Using the target binary version value "1.0" from "ios/reactnative/Info.plist".
Running "react-native bundle" command:
node node_modules/react-native/local-cli/cli.js bundle --assets-dest /var/folders/gy/737c70fj7tq3pwdw758glxz00000gp/T/code-push118924-95814-1e6qqdj.df3g/CodePush --bundle-output /var/folders/gy/737c70fj7tq3pwdw758glxz00000gp/T/code-push118924-95814-1e6qqdj.df3g/CodePush/main.jsbundle --dev false --entry-file index.js --platform ios
Loading dependency graph, done.
bundle: Writing bundle output to: /var/folders/gy/737c70fj7tq3pwdw758glxz00000gp/T/code-push118924-95814-1e6qqdj.df3g/CodePush/main.jsbundle
bundle: Done writing bundle output
bundle: Copying 6 asset files
bundle: Done copying assets
Releasing update contents to CodePush:
Successfully released an update containing the "/var/folders/gy/737c70fj7tq3pwdw758glxz00000gp/T/code-push118924-95814-1e6qqdj.df3g/CodePush" directory to the "Production" deployment of the "appName" app.
Second, I go to the AppCenter website, select the successfully pushed version, and do a force roll out to every app.
I've tried to restart the app, reinstall the app, etc...but the app does not update from CodePush servers.
In my XCode console, I see:
loading - codepush2018-10-24 12:10:10.837955+0200 reactnative[5546:3916480]
[CodePush] Loading JS bundle from file:///Users/myUser/Library/Developer/CoreSimulator/Devices/4E7D0B07-B6B2-4D3C-B5B8-F28F3DA47077/data/Containers/Bundle/Application/081FD17C-B182-488D-B2D1-C786A3B25AAB/reactnative.app/main.jsbundle
Does this mean that CodePush is loading from local?
I believe I am running the release scheme correctly:
class App extends React.Component {
constructor(props){
super(props)
}
componentDidMount() {
codePush.sync({
updateDialog: true,
installMode: codePush.InstallMode.IMMEDIATE
});
}
render(){
return <Main screenProps={this.props} />
}
}
const codePushOptions = { checkFrequency: codePush.CheckFrequency.ON_APP_RESUME };
const ConnectedApp = codePush(codePushOptions)(connect(state => state)(App))
firebase.auth().onAuthStateChanged(auth => {
if(auth){
store.dispatch(setUser(auth))
}else{
store.dispatch(logout())
}
})
export default () => (
<Provider store={store}>
<ConnectedApp />
</Provider>
)
I also do not see the updateDialog: true when App mounts.
The Code Push keys must be same to the environment to which the application is being released and the one to which the application is built in order to receive the changes.
There are two possible solutions in order to avoid this conflict.
Define separate Build Schemes.
Add a custom script that changes Code Push keys with the environment change.
Build Schemes / Types
Android
android {
...
buildTypes {
releaseStaging {
...
buildConfigField "String", "CODEPUSH_KEY", '"<INSERT_STAGING_KEY>"'
...
}
release {
...
buildConfigField "String", "CODEPUSH_KEY", '"<INSERT_PRODUCTION_KEY>"'
...
}
}
...
}
Source
In the android/app/build.gradle you can defined the various buildTypes and build the app based on it
IOS
Under the Info tab click the + button within Configurations and Duplicate "Release" Configuration and set its name to Staging
Now you can configure the User Defined Settings and define a new setting CODEPUSH_KEY and set ${CODEPUSH_KEY} variable to the different schemes.
Elaborated steps are explained here: Source
Custom Script
Alternatively, if you don't want to add more Build Schemes / Types, you can add a custom script that changes keys based on the environment.
change-environment.sh
#!/usr/bin/env bash
#################################
# Change the environment variable
#################################
environment=$1
# Read Directory Path
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$parent_path"
rm ../.env
# Set NODE_ENV in your .env file based on the script
echo "NODE_ENV=${environment}" > ../.env
#################################
# Change the code push key
#################################
if [ "$environment" = "staging" ]
then
echo "Change Code Push Key - Staging"
sed -i '' -E 's/CODEPUSH_KEY ?= ?".+"/CODEPUSH_KEY = "${YOUR_STAGING_IOS_CODEPUSH_KEY}"/' ../ios/YourProj.xcodeproj/project.pbxproj
sed -i '' -E 's/buildConfigField "String", "CODEPUSH_KEY", '\''".+"'\''/buildConfigField "String", "CODEPUSH_KEY", '\''"${YOUR_STAGING_ANDROID_CODEPUSH_KEY}"'\''/' ../android/app/build.gradle
elif [ "$environment" = "production" ]
then
echo "Change Code Push Key - Production"
sed -i '' -E 's/CODEPUSH_KEY ?= ?".+"/CODEPUSH_KEY = "${YOUR_PRODUCTION_IOS_CODEPUSH_KEY}"/' ../ios/YourProj.xcodeproj/project.pbxproj
sed -i '' -E 's/buildConfigField "String", "CODEPUSH_KEY", '\''".+"'\''/buildConfigField "String", "CODEPUSH_KEY", '\''"${YOUR_PRODUCTION_ANDROID_CODEPUSH_KEY}"'\''/' ../android/app/build.gradle
fi
Now you can run .${SCRIPT_PATH}/change-environment.sh ${ENV}
Example: ./change-environment.sh staging
This script changes the buildConfigField in android buildTypes and CODEPUSH_KEY User Defined Settings to the pre defined schemes in ios.
It would be convenient combine this script with the react native's packager start command in your package.json
"start": "./change-environment.sh development && node node_modules/react-native/local-cli/cli.js start",
"start:staging": "./change-environment.sh staging && node node_modules/react-native/local-cli/cli.js start",
"start:production": "./change-environment.sh production && node node_modules/react-native/local-cli/cli.js start",
The CodePush is not loading from exactly, it downloads the bundle from the CodePush server. So path you have seen is a path part of your simulator's file system.
Please refer here to know how to set deployment target
https://learn.microsoft.com/en-us/appcenter/distribution/codepush/react-native
running the release script without publish option tries to publish the build to GitHub ( and fails while complaining about not being able to find GHToken! )
Error: GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"
Setting "publish": "never" will fail also complaining about not being able to find module electron-publisher-never!
Error: Cannot find module 'electron-publisher-never'
It all happens while the project is built but build scripts exits non-zero!
I'm using the latest version of electron-builder.
my build script:
"build": {
"appId": "eu.armand.[****]",
"copyright": "Copyright © 2017 mim_Armand",
"productName": "[****]",
"mac": {
"publish": "never",
"category": "public.app-category.[****]",
"icon": "assets/icons/mac/icon.icns"
}
Any idea what's going on or if I'm doing it wrong?!
,m
try building with
"build": "electron-builder --publish never"
to never publish.
rename your script to something else.
if the script name is release → publish is set to always
the documentation states this:
CLI --publish option values:
...
If npm script named release, — always.
Add to scripts in the development package.json:
"release": "build"
and if you run yarn release, a release will be drafted (if doesn’t
already exist) and artifacts published.
I solved it this way, because I didn't need to put it in any repository
"build":{
"appId": "XXX",
"productName": "XXX",
"directories":{
"output": "build"
},
"win":{
"target": "nsis",
"publish" : []
}
}
https://www.electron.build/configuration/publish
I have an Electron app where I want to introduce parallel release channels: stable, next (for early adopters) and dev (for testing the latest build).
These will have a branch each, with new features appearing first in dev, progressing to next for beta testing and finally moving into stable.
I'm using electron-builder to make these release packages, and I want each to have its own auto-updates - so when I publish a new next release all the users with it get the update.
I want the applications to be independent - a user can have two channels installed and run both at the same time. They'll have different names and different icons.
I can manually set these up in the branches, but really I want to automate this as much as possible - a publish from the next branch should use the right name, icons, IDs and updater without risk of it going to the wrong channel.
Is there a way to do this with electron or electron-builder?
It's possible with electron-builder. I would have several build configurations and tell electron-builder which to use when building.
For example, create file config/beta.json with the following setup:
{
"appId": "com.company.beta",
"productName": "App Beta",
"directories": {
"buildResources": "build/beta" // directory containing your build-specific assets (e.g., beta icons - icon.icns, icon.ico & background.png)
},
"mac": {
"category": "public.app-category.finance"
},
"win": {
"target": [
"nsis"
]
},
"nsis": {
"perMachine": false
},
"publish": [
{
"provider": "s3",
"bucket": "com-app-beta" // dedicated S3 bucket for each build
}
],
}
And duplicate config/beta.json for next.json and current.json (make sure to edit settings accordingly).
In package.json, add the following build scripts (note --em.name=app-beta to overwrite package.json's "name" value):
{
"scripts": {
"build": "build -owl --x64 --config ./config/current.json -p always --em.name=app",
"build-beta": "build -owl --x64 --config ./config/beta.json -p always --em.name=app-beta",
"build-next": "build -owl --x64 --config ./config/next.json -p always --em.name=app-next"
}
}
Run build script when ready to deploy:
npm run build-beta
Using electron-builder version 20.15.1 and MacOS, #Jon Saw's solution needs a minor change because em option is not valid:
"build-beta": "build -owl --x64 --config ./config/beta.json -p always -c.extraMetadata.name=app-beta"