macOS 使用 Jenkins 打包 Android 保姆级入门教程 --> pipeline

基本配置

参照 macOS 使用 Jenkins 打包 Android 保姆级入门教程 –> freestyle 这篇文章

构建脚本

同样注意,这里面的环境变量也是和机器是隔离的,第一次使用的时候,把注释解开,把nvmnpm/yarn配好,后面再构建的时候,注释掉即可 …

pipeline {
agent any
environment {
PATH = "$HOME/.nvm/versions/node/v20.11.0/bin:$PATH"
JAVA_HOME = "/Users/net.cctv3.i/.sdkman/candidates/java/17.0.9-oracle"
}
stages {
stage('Git clone') {
steps {
sh 'export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890'
git branch: 'main', url: 'git@github.com:StationChnqoo/x.git'
}
}

stage('Config nvm') {
steps {
// sh 'export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890'
// sh 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash'
// sh 'cd shells && ./install-nvm-0.39.7.sh'
// nvm ls-remote
// sh 'source $HOME/.nvm/nvm.sh && nvm install 20.11.0'
sh 'source $HOME/.nvm/nvm.sh && nvm use 20.11.0'
}
}
stage('npm install') {
steps {
script {
sh '/usr/local/bin/yarn install'
}
}
}

stage('build') {
steps {
script {
sh 'cd android; ENVFILE=.env.staging ./gradlew assembleRelease'
}
}
}
}
}

macOS 使用 Jenkins 打包 Android 保姆级入门教程 --> pipeline

https://www.cctv3.net/static/20240214/macos-jenkins-build-android-pipeline.html

作者

江北饮马、江南折花

发布于

2024-02-14

更新于

2024-02-19

许可协议

评论