config.xml 4.5 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
current_date=$(date +&quot;%Y%m%d&quot;)

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

73 74
git_short_hash=$(echo ${GIT_COMMIT}|cut -c1-8)

75
scheme=&quot;Runner&quot;
76

77 78
# package configuration for fastlane
configuration=${BUILD_TYPE}
79

80
# export methods supports app-store, package, ad-hoc, enterprise, development and developer-id.
81 82 83 84 85 86 87 88 89
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
90

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

94 95 96 97
# ipa export folder
rm -rf &quot;${project_path}/ipa&quot;
mkdir -p &quot;${project_path}/ipa&quot;
output_path=&quot;${project_path}/ipa&quot;
98

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

102
# ipa export path
103
ipa_path=&quot;$output_path/hi365_${app_version}.ipa&quot;
104

105
# ipa name
106
ipa_name=&quot;Hi365_SIT_${current_date}_${git_short_hash}.ipa&quot;
107
commit_msg=&quot;$1&quot;
108 109

# show env settings
110 111 112 113 114
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;
115 116

# Clean build and deploy
117 118 119 120 121
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>
122 123
    </hudson.tasks.Shell>
  </builders>
124
  <publishers/>
125 126 127 128 129 130 131 132
  <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>
133
</project>