config.xml 4.75 KB
Newer Older
1 2 3 4 5 6
<?xml version='1.1' encoding='UTF-8'?>
<project>
  <actions/>
  <description>打包 APK,不做 code push</description>
  <keepDependencies>false</keepDependencies>
  <properties>
7
    <com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty plugin="gitlab-plugin@1.5.12">
8 9
      <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
    <hudson.model.ParametersDefinitionProperty>
      <parameterDefinitions>
        <hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition plugin="global-variable-string-parameter@1.2">
          <name>GIT_BRANCH</name>
          <description>develop
feature/I18N
release/1.47
hotfix/1.47.1</description>
          <defaultValue>develop</defaultValue>
          <trim>false</trim>
        </hudson.plugins.global__variable__string__parameter.GlobalVariableStringParameterDefinition>
        <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>
      </parameterDefinitions>
    </hudson.model.ParametersDefinitionProperty>
29 30 31 32 33 34 35 36
    <jenkins.model.BuildDiscarderProperty>
      <strategy class="hudson.tasks.LogRotator">
        <daysToKeep>2</daysToKeep>
        <numToKeep>5</numToKeep>
        <artifactDaysToKeep>-1</artifactDaysToKeep>
        <artifactNumToKeep>-1</artifactNumToKeep>
      </strategy>
    </jenkins.model.BuildDiscarderProperty>
37
  </properties>
38
  <scm class="hudson.plugins.git.GitSCM" plugin="git@3.10.0">
39 40 41 42 43 44 45 46 47
    <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>
48
        <name>*/${GIT_BRANCH}</name>
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
      </hudson.plugins.git.BranchSpec>
    </branches>
    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
    <submoduleCfg class="list"/>
    <extensions/>
  </scm>
  <assignedNode>MAC_BUILD_Machine</assignedNode>
  <canRoam>false</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers/>
  <concurrentBuild>false</concurrentBuild>
  <builders>
    <hudson.tasks.Shell>
64
      <command>PATH=&quot;$HOME/.rvm/bin:/usr/local/bin:$PATH:/Users/jenkins/.fastlane/bin/&quot;
65 66 67
VERSION=SIT_$(date +%Y%m%d)_$(git rev-parse --short HEAD)
MODIFIED_DATE=$(git log -1 --format=&quot;%ci&quot; --)

68 69 70 71 72 73 74 75
# 加速打包,正式時還是要包
GYM_INCLUDE_SYMBOLS=false
GYM_INCLUDE_BITCODE=false

gem install bundler
bundler install

yarn install
76

77
sed -i &apos;&apos; &quot;/url/s/http.*\//http:\/\/${API_SERVER}\//g&quot; src/configs/index.js
78 79
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
80
sed -i &apos;&apos; &quot;/allergyUrl/s/\__DEV__.*\&apos;;/\&apos;http:\/\/${API_SERVER}\/\&apos;;/&quot; src/configs/index.js
81 82 83 84
sed -i &apos;&apos; &apos;s/appVersion.*/appVersion&quot;: &quot;1.27&quot;/&apos; appConfig.json

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

85
npm run build-thread-android
86 87 88 89 90 91 92 93
fastlane android beta</command>
    </hudson.tasks.Shell>
    <hudson.tasks.Shell>
      <command>VERSION=SIT_$(date +%Y%m%d)_$(git rev-parse --short HEAD)
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
94
scp -i ~/jenkins/jenkins ~/Sites/${NAME}_${VERSION}.apk appuploader@10.57.117.135:~/app/hrb/</command>
95 96 97
    </hudson.tasks.Shell>
  </builders>
  <publishers>
98
    <hudson.tasks.Mailer plugin="mailer@1.23">
99 100 101 102 103 104
      <recipients>$RD_Group $QA_Group</recipients>
      <dontNotifyEveryUnstableBuild>true</dontNotifyEveryUnstableBuild>
      <sendToIndividuals>false</sendToIndividuals>
    </hudson.tasks.Mailer>
  </publishers>
  <buildWrappers>
105
    <hudson.plugins.ws__cleanup.PreBuildCleanup plugin="ws-cleanup@0.37">
106 107 108 109 110 111 112
      <deleteDirs>false</deleteDirs>
      <cleanupParameter></cleanupParameter>
      <externalDelete></externalDelete>
      <disableDeferredWipeout>false</disableDeferredWipeout>
    </hudson.plugins.ws__cleanup.PreBuildCleanup>
  </buildWrappers>
</project>