diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2131843f..14adf703 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -98,7 +98,6 @@ generate_git_tag: stage: generate_tag_or_version extends: .generate_tag_rule before_script: - - bash pre_build.sh xhj - bash pre_build.sh sky - project_url=$(echo $CI_PROJECT_URL | sed 's/http:\/\///') - echo "project_url:$project_url" @@ -155,16 +154,10 @@ create-release: - export StarLock_VERSION=${CI_COMMIT_TAG#*-} - echo "Uploading StarLock-${StarLock_VERSION} packages to ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/StarLock-${StarLock_VERSION}-*" - - 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-apk/starlock-xhj-release-${CI_COMMIT_TAG}.apk - "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/starlock-xhj-release-${CI_COMMIT_TAG}.apk"' - - 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-apk/starlock-xhj_bundle-release-${CI_COMMIT_TAG}.aab - "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/starlock-xhj_bundle-release-${CI_COMMIT_TAG}.aab"' - 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-apk/starlock-sky-release-${CI_COMMIT_TAG}.apk "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/starlock-sky-release-${CI_COMMIT_TAG}.apk"' - 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-apk/starlock-sky-release-${CI_COMMIT_TAG}.aab "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/starlock-sky-release-${CI_COMMIT_TAG}.aab"' - - 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-ipa/starlock-xhj-release-${CI_COMMIT_TAG}.ipa - "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/starlock-xhj-release-${CI_COMMIT_TAG}.ipa"' - 'curl -i --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/app/outputs/flutter-ipa/starlock-sky-release-${CI_COMMIT_TAG}.ipa "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${StarLock_VERSION}/starlock-sky-release-${CI_COMMIT_TAG}.ipa"' release: @@ -174,21 +167,12 @@ create-release: ref: '$CI_COMMIT_TAG' assets: links: - - name: 'xhj apk binary package' - url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/starlock-xhj-release-${CI_COMMIT_TAG}.apk' - link_type: 'package' - - name: 'xhj bundle binary package' - url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/starlock-xhj_bundle-release-${CI_COMMIT_TAG}.aab' - link_type: 'package' - name: 'sky apk binary package' url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/starlock-sky-release-${CI_COMMIT_TAG}.apk' link_type: 'package' - name: 'sky bundle binary package' url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/starlock-sky-release-${CI_COMMIT_TAG}.aab' link_type: 'package' - - name: 'xhj ipa binary package' - url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/starlock-xhj-release-${CI_COMMIT_TAG}.ipa' - link_type: 'package' - name: 'sky ipa binary package' url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/StarLock/${CI_COMMIT_TAG}/starlock-sky-release-${CI_COMMIT_TAG}.ipa' link_type: 'package' diff --git a/android/build.sh b/android/build.sh index 40a15413..ae42354d 100755 --- a/android/build.sh +++ b/android/build.sh @@ -13,21 +13,16 @@ regex='^v[0-9]+\.[0-9]+\.[0-9]+_sky$' if [[ "${ENV_BUILD_BRANCH}" == "canary_release_sky" ]]; then echo "===build canary_release: ${NEXT_VERSION}" export ENV_BUILD_TAG=${NEXT_VERSION} - bundle exec fastlane release_apk flavor:xhj --verbose bundle exec fastlane release_apk flavor:sky --verbose elif [[ $ENV_BUILD_TAG =~ $regex ]]; then echo "===build release===$ENV_BUILD_TAG" - bundle exec fastlane release_apk flavor:xhj --verbose bundle exec fastlane release_apk flavor:sky --verbose - bundle exec fastlane release_bundle flavor:xhj_bundle --verbose bundle exec fastlane release_bundle flavor:sky --verbose elif [[ "${ENV_BUILD_BRANCH}" == "develop_sky" ]]; then echo "===build dev===${NEXT_VERSION}" - bundle exec fastlane beta flavor:xhj env:dev --verbose bundle exec fastlane beta flavor:sky env:dev --verbose elif [[ "${ENV_BUILD_BRANCH}" == "release_sky" || "${ENV_BUILD_BRANCH}" == "feat_devops_sky" ]] ; then echo "===build pre===${NEXT_VERSION}" - bundle exec fastlane beta flavor:xhj env:pre --verbose bundle exec fastlane beta flavor:sky env:pre --verbose fi exit 0 \ No newline at end of file diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index a99f62f0..bd6d5449 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -44,10 +44,6 @@ platform :android do print_header '🏁 Before All' print_log $current_branch print_log $current_tag - print_log $path_file_preview_apk_default - print_log $path_file_release_apk_default - print_log $path_file_preview_apk_copy - print_log $path_file_release_apk_copy Dir.chdir "../.." do sh('pwd') end @@ -55,11 +51,9 @@ platform :android do desc "Submit a new Beta Build to Pgy Beta" lane :beta do |options| - flavor = options[:flavor] env = options[:env] - UI.user_error!("flavor is required") unless flavor UI.user_error!("env is required") unless env - print_log "build #{flavor} on #{env}" + print_log "build sky on #{env}" build_number = Time.now.strftime("%Y%m%d%H") print_log "BuildNo #{build_number}" build_version = $next_version @@ -70,10 +64,10 @@ platform :android do remove_zone_pre_build(zone:"com") Dir.chdir "../.." do sh("flutter","pub","get") - sh("flutter", "build", "apk", "--no-tree-shake-icons", "--release", "--flavor", "#{flavor}_#{env}", "-t", "lib/main_#{flavor}_#{env}.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") + sh("flutter", "build", "apk", "--no-tree-shake-icons", "--release", "--flavor", "sky_#{env}", "-t", "lib/main_sky_#{env}.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") end - old_file_path = File.join($path_apk_output_dir, "app-#{flavor}_#{env}-release.apk") - new_file_path = File.join($path_apk_output_dir, "starlock-#{flavor}-preview-#{build_version}.apk") + old_file_path = File.join($path_apk_output_dir, "app-sky_#{env}-release.apk") + new_file_path = File.join($path_apk_output_dir, "starlock-sky-preview-#{build_version}.apk") File.rename(old_file_path, new_file_path) logs = changelog_from_git_commits( pretty: '- %s (%cn)', @@ -85,9 +79,7 @@ platform :android do desc "Build & upload a new version to Gitlab Release" lane :release_apk do |options| - flavor = options[:flavor] - UI.user_error!("flavor is required") unless flavor - print_log "build flavor for: #{flavor}" + print_log "build sky" build_number = Time.now.strftime("%Y%m%d%H") print_log "BuildNo #{build_number}" build_version = $current_tag.match(/^v(\d+\.\d+\.\d+)/).captures[0] @@ -98,18 +90,16 @@ platform :android do remove_zone_pre_build(zone:"com") Dir.chdir "../.." do sh("flutter","pub","get") - sh("flutter", "build", "apk", "--no-tree-shake-icons", "--release", "--flavor", "#{flavor}", "-t", "lib/main_#{flavor}_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") + sh("flutter", "build", "apk", "--no-tree-shake-icons", "--release", "--flavor", "sky", "-t", "lib/main_sky_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") end - old_apk_file_path = File.join($path_apk_output_dir, "app-#{flavor}-release.apk") - new_apk_file_path = File.join($path_apk_output_dir, "starlock-#{flavor}-release-"+$current_tag+".apk") + old_apk_file_path = File.join($path_apk_output_dir, "app-sky-release.apk") + new_apk_file_path = File.join($path_apk_output_dir, "starlock-sky-release-"+$current_tag+".apk") File.rename(old_apk_file_path, new_apk_file_path) end desc "Build & upload a new version to Gitlab Release" lane :release_bundle do |options| - flavor = options[:flavor] - UI.user_error!("flavor is required") unless flavor - print_log "build flavor for: #{flavor}" + print_log "build sky" build_number = Time.now.strftime("%Y%m%d%H") print_log "BuildNo #{build_number}" build_version = $current_tag.match(/^v(\d+\.\d+\.\d+)/).captures[0] @@ -120,10 +110,10 @@ platform :android do remove_zone_pre_build(zone:"cn") Dir.chdir "../.." do sh("flutter","pub","get") - sh("flutter", "build", "appbundle", "--no-tree-shake-icons", "--release", "--flavor", "#{flavor}", "-t", "lib/main_#{flavor}_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") + sh("flutter", "build", "appbundle", "--no-tree-shake-icons", "--release", "--flavor", "sky", "-t", "lib/main_sky_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") end - old_bundle_file_path = File.join($path_bundle_output_dir , "/#{flavor}Release/app-#{flavor}-release.aab") - new_bundle_file_path = File.join($path_bundle_output_dir , "/#{flavor}Release/starlock-#{flavor}-release-"+$current_tag+".aab") + old_bundle_file_path = File.join($path_bundle_output_dir , "/skyRelease/app-sky-release.aab") + new_bundle_file_path = File.join($path_bundle_output_dir , "/skyRelease/starlock-sky-release-"+$current_tag+".aab") File.rename(old_bundle_file_path, new_bundle_file_path) sh('cp',new_bundle_file_path,$path_apk_output_dir) end diff --git a/ios/build.sh b/ios/build.sh index 2c46b1f1..2010a2cb 100755 --- a/ios/build.sh +++ b/ios/build.sh @@ -14,19 +14,15 @@ regex='^v[0-9]+\.[0-9]+\.[0-9]+_sky$' if [[ "${ENV_BUILD_BRANCH}" == "canary_release_sky" ]]; then echo "===build canary_release: ${NEXT_VERSION}" export ENV_BUILD_TAG=${NEXT_VERSION} - bundle exec fastlane release_ipa flavor:xhj --verbose bundle exec fastlane release_ipa flavor:sky --verbose elif [[ $ENV_BUILD_TAG =~ $regex ]]; then echo "===build release===$ENV_BUILD_TAG" - bundle exec fastlane release_ipa flavor:xhj --verbose bundle exec fastlane release_ipa flavor:sky --verbose elif [[ "${ENV_BUILD_BRANCH}" == "develop_sky" ]]; then echo "===build dev===${NEXT_VERSION}" - bundle exec fastlane beta flavor:xhj env:Dev --verbose bundle exec fastlane beta flavor:sky env:Dev --verbose elif [[ "${ENV_BUILD_BRANCH}" == "release_sky" || "${ENV_BUILD_BRANCH}" == "feat_devops_sky" ]] ; then echo "===build pre===${NEXT_VERSION}" - bundle exec fastlane beta flavor:xhj env:Pre --verbose bundle exec fastlane beta flavor:sky env:Pre --verbose fi exit 0 \ No newline at end of file diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 895ba92e..2ab2fc24 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -17,22 +17,13 @@ default_platform(:ios) # setup_travis -# --- xhj Const --- -$signing_identity_xhj_distribution = 'iPhone Distribution: Shenzhen Xinhongjia Electronics Co., Ltd. (P8997RW3V8)' -$app_identifier = 'xhj' -$provisioning_name_adhoc = 'StarApt Project Mobile Ad Hoc' -$provisioning_name_distribution = 'StarApt Project Mobile Distribution' -$gym_config_sky_preview = 'Preview-xhj' -$gym_config_sky_release = 'Release' - # --- sky Const --- -$signing_identity_sky_distribution = 'iPhone Distribution: Shenzhen Xinhongjia Electronics Co., Ltd. (P8997RW3V8)' +$signing_identity_distribution = 'iPhone Distribution: Shenzhen Xinhongjia Electronics Co., Ltd. (P8997RW3V8)' $app_identifier = 'sky' $provisioning_name_adhoc = 'StarApt Project Mobile Ad Hoc' $provisioning_name_distribution = 'StarApt Project Mobile Distribution' -$gym_config_sky_preview = 'Preview-sky' -$gym_config_sky_release = 'Release' - +$gym_config_preview = 'Preview-sky' +$gym_config_release = 'Release' # --- common Const --- $match_type_adhoc = 'adhoc' @@ -72,14 +63,12 @@ platform :ios do desc "Build & Deliver to Pgy" lane :beta do |options| - flavor = options[:flavor] env = options[:env] - UI.user_error!("flavor is required") unless flavor UI.user_error!("env is required") unless env - print_log "build #{flavor} on #{env}" + print_log "build sky on #{env}" build_number = Time.now.strftime("%Y%m%d%H%M") print_log "Build Commits #{build_number}" - build_version = $next_version # Time.now.strftime("%Y%m%d%H%M%S") + build_version = $next_version print_log "build_version #{build_version}" commit_hash = last_git_commit short_hash = commit_hash[:abbreviated_commit_hash] @@ -89,18 +78,16 @@ platform :ios do sh("flutter","pub","get") end Dir.chdir ".." do - #sh("bundle", "exec" ,"pod", "install") sh("pod", "install") end Dir.chdir "../.." do - sh("flutter", "build", "ios", "--no-tree-shake-icons", "--no-codesign", "--release", "--flavor", "#{flavor}", "-t", "lib/main_#{flavor}_#{env}.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") + sh("flutter", "build", "ios", "--no-tree-shake-icons", "--no-codesign", "--release", "--flavor", "sky", "-t", "lib/main_sky_#{env}.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") end - #set_bundle_short_version('./Runner/Info.plist', $current_branch) - gym_scheme_preview="#{flavor}" + gym_scheme_preview="sky" print_log "gym_scheme_preview #{gym_scheme_preview}" - gym_configuration = "#{env}-release-#{flavor}" + gym_configuration = "#{env}-release-sky" print_log "gym_configuration #{gym_configuration}" - ipa_default_filename = "starlock-#{flavor}-preview-#{build_version}.ipa" + ipa_default_filename = "starlock-sky-preview-#{build_version}.ipa" print_log "ipa_default_filename #{ipa_default_filename}" gym( scheme: gym_scheme_preview, @@ -111,10 +98,8 @@ platform :ios do export_method: "ad-hoc", export_options: { provisioningProfiles: { - "com.xhjcn.lock.dev" => "Adhoc_com.xhjcn.lock.dev.mobileprovision", - "com.xhjcn.lock.pre" => "Adhoc_com.xhjcn.lock.pre.mobileprovision", "com.skychip.lock.dev" => "Adhoc_com.skychip.lock.dev.mobileprovision", - "com.skychip.lock.pre" => "Adhoc_com.skychip.lock.pre.mobileprovision", + "com.skychip.lock.pre" => "Adhoc_com.skychip.lock.pre.mobileprovision" } } ) @@ -128,9 +113,7 @@ platform :ios do desc "Build & Deliver to App Store Connect" lane :release_ipa do |options| - flavor = options[:flavor] - UI.user_error!("flavor is required") unless flavor - print_log "build flavor: #{flavor}" + print_log "build sky" build_number = Time.now.strftime("%Y%m%d%H%M") print_log "Build Commits #{build_number}" build_version = $current_tag.match(/^v(\d+\.\d+\.\d+)/).captures[0] @@ -143,17 +126,16 @@ platform :ios do sh("flutter","pub","get") end Dir.chdir ".." do - #sh("bundle", "exec" ,"pod", "install") sh("pod", "install") end Dir.chdir "../.." do - sh("flutter", "build", "ios", "--no-tree-shake-icons", "--no-codesign", "--release", "--flavor", "#{flavor}", "-t", "lib/main_#{flavor}_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") + sh("flutter", "build", "ios", "--no-tree-shake-icons", "--no-codesign", "--release", "--flavor", "sky", "-t", "lib/main_sky_lite.dart", "--build-number=#{build_number}", "--build-name=#{build_version}") end - gym_scheme_release="#{flavor}" + gym_scheme_release="sky" print_log "gym_scheme_release #{gym_scheme_release}" - gym_configuration = "Release-#{flavor}" + gym_configuration = "Release-sky" print_log "gym_configuration #{gym_configuration}" - ipa_default_filename = "starlock-#{flavor}-release-"+$current_tag+".ipa" + ipa_default_filename = "starlock-sky-release-"+$current_tag+".ipa" print_log "ipa_default_filename #{ipa_default_filename}" gym( scheme: gym_scheme_release, @@ -164,12 +146,11 @@ platform :ios do export_method: "app-store", export_options: { provisioningProfiles: { - "com.xhjcn.lock" => "Appstore_com.xhjcn.lock.mobileprovision", - "com.skychip.lock" => "Appstore_com.skychip.lock.mobileprovision", + "com.skychip.lock" => "Appstore_com.skychip.lock.mobileprovision" } } ) - auth_key_prefix=flavor.upcase + auth_key_prefix="SKY" print_log "auth_key_prefix #{auth_key_prefix}" api_key = app_store_connect_api_key( key_id: ENV["#{auth_key_prefix}_APPLE_AUTH_KEY_ID"], diff --git a/notify.sh b/notify.sh index 0a5ecf90..05a33d84 100755 --- a/notify.sh +++ b/notify.sh @@ -6,20 +6,16 @@ if [[ "${CI_COMMIT_BRANCH}" == "release_sky" ]] ; then WECAHT_WEBHOOK_URL=$PRE_QYWECAHT_WEBHOOK_URL SKY_IOS_DOWNLOAD_URL=$PRE_SKY_IOS_DOWNLOAD_URL SKY_ANDROID_DOWNLOAD_URL=$PRE_SKY_ANDROID_DOWNLOAD_URL - XHJ_IOS_DOWNLOAD_URL=$PRE_XHJ_IOS_DOWNLOAD_URL - XHJ_ANDROID_DOWNLOAD_URL=$PRE_XHJ_ANDROID_DOWNLOAD_URL elif [[ "${CI_COMMIT_BRANCH}" == "develop_sky" ]] || [[ "${CI_COMMIT_BRANCH}" == "feat_devops_sky" ]]; then WECAHT_WEBHOOK_URL=$DEV_QYWECAHT_WEBHOOK_URL SKY_IOS_DOWNLOAD_URL=$DEV_SKY_IOS_DOWNLOAD_URL SKY_ANDROID_DOWNLOAD_URL=$DEV_SKY_ANDROID_DOWNLOAD_URL - XHJ_IOS_DOWNLOAD_URL=$DEV_XHJ_IOS_DOWNLOAD_URL - XHJ_ANDROID_DOWNLOAD_URL=$DEV_XHJ_ANDROID_DOWNLOAD_URL fi if [[ "${BUILD_STATUS}" == "success" ]]; then TITLE="😎 构建成功" BUILD_STATUS_DESC="成功" - NOTIFICATION_CONENT='{"msgtype":"markdown","markdown":{"content":"'$TITLE'\n> **项目名称**: '$APP_PRODUCT_NAME'\n> **分支**: '$CI_COMMIT_REF_NAME'\n> **构建状态**: '$BUILD_STATUS_DESC'\n> **安装地址**:\n 锁通通 ** [iOS]('$SKY_IOS_DOWNLOAD_URL') ** ** [Android]('$SKY_ANDROID_DOWNLOAD_URL')**\n > ** 星星锁 ** [iOS]('$XHJ_IOS_DOWNLOAD_URL') ** ** [Android]('$XHJ_ANDROID_DOWNLOAD_URL')** \n> **详情查看**: [构建日志]('$CI_JOB_URL')"}}' + NOTIFICATION_CONENT='{"msgtype":"markdown","markdown":{"content":"'$TITLE'\n> **项目名称**: '$APP_PRODUCT_NAME'\n> **分支**: '$CI_COMMIT_REF_NAME'\n> **构建状态**: '$BUILD_STATUS_DESC'\n> **安装地址**:\n 锁通通 ** [iOS]('$SKY_IOS_DOWNLOAD_URL') ** ** [Android]('$SKY_ANDROID_DOWNLOAD_URL')** \n> **详情查看**: [构建日志]('$CI_JOB_URL')"}}' else TITLE="😥 部署失败" BUILD_STATUS_DESC="失败"