diff --git a/.env b/.env new file mode 100644 index 000000000..b3ae6ea7f --- /dev/null +++ b/.env @@ -0,0 +1,18 @@ +APP_ID_IOS=app.covidshield +APP_ID_ANDROID=app.covidshield + +APP_VERSION_NAME=1.0 +APP_VERSION_CODE=47 + +SUBMIT_URL=https://submission.covidshield.app +RETRIEVE_URL=https://retrieval.covidshield.app + +HMAC_KEY=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +TEST_MODE=true +MOCK_SERVER=false + +MCC_CODE=302 + +TRANSMISSION_RISK_LEVEL=4 +MINIMUM_FETCH_INTERVAL=15 diff --git a/.env.production b/.env.production new file mode 100644 index 000000000..b3ae6ea7f --- /dev/null +++ b/.env.production @@ -0,0 +1,18 @@ +APP_ID_IOS=app.covidshield +APP_ID_ANDROID=app.covidshield + +APP_VERSION_NAME=1.0 +APP_VERSION_CODE=47 + +SUBMIT_URL=https://submission.covidshield.app +RETRIEVE_URL=https://retrieval.covidshield.app + +HMAC_KEY=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +TEST_MODE=true +MOCK_SERVER=false + +MCC_CODE=302 + +TRANSMISSION_RISK_LEVEL=4 +MINIMUM_FETCH_INTERVAL=15 diff --git a/.gitignore b/.gitignore index b670710a2..c2420c9f0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,9 +2,6 @@ # .DS_Store - -.env.production - # Xcode # build/ @@ -93,7 +90,6 @@ ios/Generated.xcconfig android/app/google-services.json .env.local .env.secrets -.env # generated files ios/assets diff --git a/fastlane/.gitignore b/fastlane/.gitignore new file mode 100644 index 000000000..4c49bd78f --- /dev/null +++ b/fastlane/.gitignore @@ -0,0 +1 @@ +.env diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 4726b14ea..30620550e 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -4,12 +4,59 @@ before_all do # Load root-level shared .env Dotenv.overload '../.env' + load_secrets + # Pull all tags git_pull(only_tags: true) end +after_all do + clean_env +end + +private_lane :ensure_clean_env do + env_status = sh("cd ../ && git status .env .env.production --porcelain") + clean = env_status.empty? + + UI.user_error!("You should not have local changes to .env or .env.production") unless clean +end + +private_lane :clean_env do + sh("cd ../ && git checkout .env .env.production") +end + +private_lane :ensure_secrets_file_exists do + file_exists = File.exist? File.expand_path "../.env.secrets" + + UI.user_error!("You appear to be missing a .env.secrets file") unless file_exists +end + +private_lane :load_secrets do + ensure_secrets_file_exists + ensure_clean_env + + # Merge secrets with the default .env file + production = Dotenv.parse("../.env.production") + debug = Dotenv.parse("../.env") + secrets = Dotenv.parse('../.env.secrets') + + production.merge!(secrets) + debug.merge!(secrets) + + production_env = "../.env.production" + debug_env = "../.env" + + File.open(production_env, 'w') do |file| + production.each{ |k, v| file.write("#{k}=#{v}\n") } + end + + File.open(debug_env, 'w') do |file| + debug.each{ |k, v| file.write("#{k}=#{v}\n") } + end +end + desc "Creates a Github Release" -lane :create_github_release do |options| +private_lane :create_github_release do |options| UI.user_error!("platform is missing") unless options[:platform] upload_assets = options[:upload_assets] ? options[:upload_assets] : [] @@ -26,7 +73,7 @@ lane :create_github_release do |options| end desc "Returns a default changelog." -lane :default_changelog do |options| +private_lane :default_changelog do |options| format = (options[:simple] ? "- %b" : "- %b [%s]") changelog = changelog_from_git_commits( @@ -39,13 +86,13 @@ lane :default_changelog do |options| clean end -lane :ensure_keystore_properties do +private_lane :ensure_keystore_properties do file_exists = File.exist? File.expand_path "../android/keystore.properties" UI.user_error!("keystore.properties file is missing!") unless file_exists end -lane :ensure_build_directory do +private_lane :ensure_build_directory do UI.message("Checking for build directories") unless File.directory?('../build/ios') diff --git a/fastlane/README.md b/fastlane/README.md index f0b2dcd24..309c21a34 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -15,34 +15,6 @@ Install _fastlane_ using or alternatively using `brew install fastlane` # Available Actions -### create_github_release -``` -fastlane create_github_release -``` -Creates a Github Release -### default_changelog -``` -fastlane default_changelog -``` -Returns a default changelog. -### ensure_keystore_properties -``` -fastlane ensure_keystore_properties -``` - -### ensure_build_directory -``` -fastlane ensure_build_directory -``` - -### test -``` -fastlane test -``` - - ----- - ## iOS ### ios beta ```