config.xml 5.51 KB
Newer Older
1 2 3
<?xml version='1.1' encoding='UTF-8'?>
<project>
  <actions/>
4
  <description>用來建置feature branch或是其他Branch使用&#xd;
5
只打包 APK, 不做Code Push</description>
6 7
  <keepDependencies>false</keepDependencies>
  <properties>
8
    <com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty plugin="gitlab-plugin@1.5.12">
9 10
      <gitLabConnection>ylhealth</gitLabConnection>
    </com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
11 12 13 14 15
    <hudson.model.ParametersDefinitionProperty>
      <parameterDefinitions>
        <hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition plugin="global-variable-string-parameter@1.2">
          <name>HRB_Mobile_Other_Branch</name>
          <description>feature branch使用的版本,如:
16
feature/HA-818
17
其他Branch請自行設定
18
develop
19 20
commitId
4c1966d510b71fdf3ec67807321a385c5378cf86</description>
21
          <defaultValue>feature/HA-1112</defaultValue>
22 23
          <trim>false</trim>
        </hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition>
24 25 26
        <hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition plugin="global-variable-string-parameter@1.2">
          <name>DownloadName</name>
          <description>下載清單上要顯示的名稱</description>
27
          <defaultValue>healthbookSDK</defaultValue>
28 29
          <trim>false</trim>
        </hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition>
30 31 32 33 34 35
        <hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition plugin="global-variable-string-parameter@1.2">
          <name>API_SERVER</name>
          <description>連線位置</description>
          <defaultValue>10.32.86.124</defaultValue>
          <trim>false</trim>
        </hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition>
36 37 38 39 40 41
        <hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition plugin="global-variable-string-parameter@1.2">
          <name>HTT_PROTOCOL</name>
          <description>http / https</description>
          <defaultValue>http</defaultValue>
          <trim>false</trim>
        </hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition>
42 43
      </parameterDefinitions>
    </hudson.model.ParametersDefinitionProperty>
44 45 46 47 48 49 50 51
    <jenkins.model.BuildDiscarderProperty>
      <strategy class="hudson.tasks.LogRotator">
        <daysToKeep>-1</daysToKeep>
        <numToKeep>5</numToKeep>
        <artifactDaysToKeep>-1</artifactDaysToKeep>
        <artifactNumToKeep>-1</artifactNumToKeep>
      </strategy>
    </jenkins.model.BuildDiscarderProperty>
52
  </properties>
53
  <scm class="hudson.plugins.git.GitSCM" plugin="git@3.10.0">
54 55 56 57 58 59 60 61 62
    <configVersion>2</configVersion>
    <userRemoteConfigs>
      <hudson.plugins.git.UserRemoteConfig>
        <url>https://cm.ylhealth.org/gitlab/ym/HRB_Mobile.git</url>
        <credentialsId>3485e854-8389-40e8-8c86-b94e94e91904</credentialsId>
      </hudson.plugins.git.UserRemoteConfig>
    </userRemoteConfigs>
    <branches>
      <hudson.plugins.git.BranchSpec>
63
        <name>*/${HRB_Mobile_Other_Branch}</name>
64 65 66 67 68 69
      </hudson.plugins.git.BranchSpec>
    </branches>
    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
    <submoduleCfg class="list"/>
    <extensions/>
  </scm>
70
  <assignedNode>Mac_Node2</assignedNode>
71 72 73 74 75 76 77 78
  <canRoam>false</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers/>
  <concurrentBuild>false</concurrentBuild>
  <builders>
    <hudson.tasks.Shell>
79
      <command>PATH=&quot;$PATH:$HOME/.rvm/bin:/usr/local/bin:/Users/jenkins/.fastlane/bin/&quot;
80
VERSION=SIT_${DownloadName}_$(date +%Y%m%d)
81 82
MODIFIED_DATE=$(git log -1 --format=&quot;%ci&quot; --)

83 84 85 86 87 88 89
# 加速打包,正式時還是要包
GYM_INCLUDE_SYMBOLS=false
GYM_INCLUDE_BITCODE=false

gem install bundler
bundler install

90
yarn install
91

92
sed -i &apos;&apos; &quot;/url/s/http.*\//${HTT_PROTOCOL}:\/\/${API_SERVER}\//g&quot; src/configs/index.js
93 94
sed -i &apos;&apos; &quot;/version/s/\&apos;.*\&apos;;/\&apos;${VERSION}\&apos;;/&quot; src/configs/index.js
sed -i &apos;&apos; &quot;/modifiedTime/s/\&apos;.*\&apos;;/\&apos;${MODIFIED_DATE}\&apos;;/&quot; src/configs/index.js
95
sed -i &apos;&apos; &quot;/allergyUrl/s/\__DEV__.*\&apos;;/\&apos;${HTT_PROTOCOL}:\/\/${API_SERVER}\/\&apos;;/&quot; src/configs/index.js
96
sed -i &apos;&apos; &apos;s/appVersion.*/appVersion&quot;: &quot;1.27&quot;/&apos; appConfig.json
97 98 99

export ANDROID_HOME=/Users/jenkins/Library/Android/sdk

100

101
npm run build-thread-android
102
bundle exec fastlane android beta</command>
103 104
    </hudson.tasks.Shell>
    <hudson.tasks.Shell>
105
      <command>VERSION=SIT_${DownloadName}_$(date +%Y%m%d)
106 107 108 109
MODIFIED_DATE=$(git log -1 --format=&quot;%ci&quot; --)
NAME=HRB_Mobile

mv android/app/build/outputs/apk/releaseStaging/app-releaseStaging.apk ~/Sites/${NAME}_${VERSION}.apk
110
scp -i ~/jenkins/jenkins ~/Sites/${NAME}_${VERSION}.ipa appuploader@10.57.117.135:~/app/hrb/</command>
111 112
    </hudson.tasks.Shell>
  </builders>
113
  <publishers/>
114
  <buildWrappers>
115
    <hudson.plugins.ws__cleanup.PreBuildCleanup plugin="ws-cleanup@0.37">
116 117 118 119 120 121 122
      <deleteDirs>false</deleteDirs>
      <cleanupParameter></cleanupParameter>
      <externalDelete></externalDelete>
      <disableDeferredWipeout>false</disableDeferredWipeout>
    </hudson.plugins.ws__cleanup.PreBuildCleanup>
  </buildWrappers>
</project>