config.xml 4.4 KB
Newer Older
1 2
<?xml version='1.1' encoding='UTF-8'?>
<project>
3
  <actions/>
4
  <description>Hi365 iOS IPA Packager</description>
5
  <keepDependencies>false</keepDependencies>
6 7 8 9
  <properties>
    <com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty plugin="gitlab-plugin@1.5.12">
      <gitLabConnection>ylhealth</gitLabConnection>
    </com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
    <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>
34 35 36 37 38 39 40 41 42 43 44
  </properties>
  <scm class="hudson.plugins.git.GitSCM" plugin="git@3.12.0">
    <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>
45
        <name>*/${BUILD_BRANCH}</name>
46 47 48 49 50 51
      </hudson.plugins.git.BranchSpec>
    </branches>
    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
    <submoduleCfg class="list"/>
    <extensions/>
  </scm>
52
  <assignedNode>Mac_Node1</assignedNode>
53
  <canRoam>false</canRoam>
54 55 56 57 58
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers/>
  <concurrentBuild>false</concurrentBuild>
59 60
  <builders>
    <hudson.tasks.Shell>
61 62
      <command>project_path=$(pwd)

63
flutter build ios
64

65
cd $project_path/ios
66

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

69 70
app_version=$(grep &apos;version:&apos; pubspec.yaml | cut -d &apos; &apos; -f2)

71
scheme=&quot;Runner&quot;
72

73 74
# package configuration for fastlane
configuration=${BUILD_TYPE}
75

76 77 78 79 80 81 82 83 84 85
# export methods supports app-store, package, ad-hoc, enterprise, development, 和developer-id,即xcodebuild的method引數
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
86

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

90 91 92 93
# ipa export folder
rm -rf &quot;${project_path}/ipa&quot;
mkdir -p &quot;${project_path}/ipa&quot;
output_path=&quot;${project_path}/ipa&quot;
94

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

98
# ipa export path
99
ipa_path=&quot;$output_path/hi365_${app_version}.ipa&quot;
100

101
# ipa name
102
ipa_name=&quot;Hi365_${app_version}.ipa&quot;
103
commit_msg=&quot;$1&quot;
104 105

# show env settings
106 107 108 109 110
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;
111 112

# Clean build and deploy
113 114 115 116 117
fastlane gym --scheme ${scheme} --clean --configuration ${configuration} --archive_path ${archive_path} --export_method ${export_method} --output_directory ${output_path} --output_name ${ipa_name}
if [ ${export_method} != &quot;app-store&quot; ]
then
echo &quot;TODO: Publish to a place where user can download&quot;
fi</command>
118 119
    </hudson.tasks.Shell>
  </builders>
120
  <publishers/>
121 122 123 124 125 126 127 128
  <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>
129
</project>