config.xml 4.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
<?xml version='1.1' encoding='UTF-8'?>
<project>
  <actions/>
  <description>Hi365 iOS IPA Packager</description>
  <keepDependencies>false</keepDependencies>
  <properties>
    <com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty plugin="gitlab-plugin@1.5.13">
      <gitLabConnection>ylhealth</gitLabConnection>
    </com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
    <hudson.model.ParametersDefinitionProperty>
      <parameterDefinitions>
        <hudson.model.ChoiceParameterDefinition>
          <name>BUILD_TYPE</name>
          <description></description>
          <choices class="java.util.Arrays$ArrayList">
            <a class="string-array">
              <string>Debug</string>
              <string>Release</string>
            </a>
          </choices>
        </hudson.model.ChoiceParameterDefinition>
        <hudson.model.ChoiceParameterDefinition>
          <name>BUILD_BRANCH</name>
          <description></description>
          <choices class="java.util.Arrays$ArrayList">
            <a class="string-array">
              <string>develop</string>
              <string>master</string>
            </a>
          </choices>
        </hudson.model.ChoiceParameterDefinition>
      </parameterDefinitions>
    </hudson.model.ParametersDefinitionProperty>
  </properties>
  <scm class="hudson.plugins.git.GitSCM" plugin="git@3.12.1">
    <configVersion>2</configVersion>
    <userRemoteConfigs>
      <hudson.plugins.git.UserRemoteConfig>
        <url>https://cm.ylhealth.org/gitlab/YongYue/hi365-app.git/</url>
        <credentialsId>3485e854-8389-40e8-8c86-b94e94e91904</credentialsId>
      </hudson.plugins.git.UserRemoteConfig>
    </userRemoteConfigs>
    <branches>
      <hudson.plugins.git.BranchSpec>
        <name>*/${BUILD_BRANCH}</name>
      </hudson.plugins.git.BranchSpec>
    </branches>
    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
    <submoduleCfg class="list"/>
    <extensions/>
  </scm>
  <assignedNode>Mac_Node1</assignedNode>
  <canRoam>false</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers/>
  <concurrentBuild>false</concurrentBuild>
  <builders>
    <hudson.tasks.Shell>
      <command>project_path=$(pwd)

flutter build ios

cd $project_path/ios

now=$(date +&quot;%Y_%m_%d_%H:%M&quot;)

current_date=$(date +&quot;%Y%m%d&quot;)

app_version=$(grep &apos;version:&apos; ${project_path}/pubspec.yaml | cut -d &apos; &apos; -f2)

git_short_hash=$(git rev-parse --short HEAD)

scheme=&quot;Runner&quot;

# package configuration for fastlane
configuration=${BUILD_TYPE}

# export methods supports app-store, package, ad-hoc, enterprise, development and developer-id.
if [ $BUILD_TYPE == &quot;Release&quot; ]
then
   	export_method=&quot;app-store&quot;
elif [ $BUILD_TYPE == &quot;AdHoc&quot; ]
then
   	export_method=&quot;ad-hoc&quot;
else
	export_method=&quot;development&quot;
fi

# iOS project path
workspace_path=&quot;${project_path}/ios/Runner.xcodeproj&quot;

# ipa export folder
rm -rf &quot;${project_path}/ipa&quot;
mkdir -p &quot;${project_path}/ipa&quot;
output_path=&quot;${project_path}/ipa&quot;

# project archive path
archive_path=&quot;$output_path/hi365_${export_method}_${now}.xcarchive&quot;

# ipa name
ipa_name=&quot;Hi365_SIT_${current_date}_${git_short_hash}.ipa&quot;

# ipa export path
ipa_path=&quot;$output_path/${ipa_name}&quot;

commit_msg=&quot;$1&quot;

# show env settings
echo &quot;===workspace path: ${workspace_path}===&quot;
echo &quot;===archive path: ${archive_path}===&quot;
echo &quot;===ipa path: ${ipa_path}===&quot;
echo &quot;===export method: ${export_method}===&quot;
echo &quot;===commit msg: $1===&quot;

# Clean build and deploy
118
fastlane gym --scheme ${scheme} --clean --configuration ${configuration} --archive_path ${archive_path} --export_method ${export_method} --output_directory ${output_path} --output_name ${ipa_name} --t lib/main_dev.dart
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
if [ ${export_method} != &quot;app-store&quot; ]
then
echo &quot;Deploy to IPA repository&quot;
scp -i ~/jenkins/jenkins ${ipa_path} appuploader@10.57.117.135:~/app/Hi365/${ipa_name}
fi</command>
    </hudson.tasks.Shell>
  </builders>
  <publishers/>
  <buildWrappers>
    <hudson.plugins.ws__cleanup.PreBuildCleanup plugin="ws-cleanup@0.37">
      <deleteDirs>false</deleteDirs>
      <cleanupParameter></cleanupParameter>
      <externalDelete></externalDelete>
      <disableDeferredWipeout>false</disableDeferredWipeout>
    </hudson.plugins.ws__cleanup.PreBuildCleanup>
  </buildWrappers>
</project>