-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yml 全局变量? #34
Comments
@sdaduanbilei 把变量 GIT_COMMIT_LOG 改为 ANDORID_OUTPUT_GIT_COMMIT_LOG |
这个配置 |
@yunheli 成功了 |
@sdaduanbilei |
至于环境变量的前缀是什么可以自己定义 |
@yunheli 如何结束 停止不进行往下走呢? |
flow:
- envs:
FLOW_AGENT_WORKSPACE: ${HOME}/agent-workspace
FLOW_ENV_OUTPUT_PREFIX: ANDORID_OUTPUT_
ANDROID_GRADLE_BUILD_TASK: assembleRelease
ANDROID_PROJECT_NAME: youprojectname
steps:
- name: Git Clone #rm -r -f 每次都会删除项目,重新clone
script: |
rm -r -f ${ANDROID_PROJECT_NAME}
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
git clone --branch ${FLOW_GIT_BRANCH} --single-branch ${FLOW_GIT_URL} ${ANDROID_PROJECT_NAME}
cd ${ANDROID_PROJECT_NAME}
export GIT_COMMIT_ID=`git rev-parse HEAD` # 获取最后一个 commit id
export ANDORID_OUTPUT_GIT_COMMIT_LOG=`git log -1`
COMMIT_PAHT=${HOME}/${ANDROID_PROJECT_NAME}.txt
echo current git log:${ANDORID_OUTPUT_GIT_COMMIT_LOG}
if [ -f "${COMMIT_PAHT}" ] # 判断文件是否存在
then
cat ${COMMIT_PAHT} | while read LINE # 读取本地的commit id
do
if [[ ${LINE} == ${GIT_COMMIT_ID} ]]
then
rm -r -f ${ANDROID_PROJECT_NAME}
echo Everything up-to-date
[["]]
exit
else
echo ${GIT_COMMIT_ID} > ${COMMIT_PAHT} # 以项目名,保存commit id到本地
fi
done
else
echo ${GIT_COMMIT_ID} > ${COMMIT_PAHT} # 以项目名,保存commit id到本地
fi
- name: QQBOT ## qq 机器人发送通知消息
script: |
echo ${ANDORID_OUTPUT_GIT_COMMIT_LOG} 已经实现commit 版本对比,成功输入 在线急等 |
Everything up-to-date
/bin/bash:行19: [[]]: 未找到命令 我目前在 这里写上一个 错误的命令,然后让整个过程出错! |
@sdaduanbilei 可以看文档 有 condition 条件比较 |
我想实现的功能是 在
git clone
的时候读取commit
记录,然后给GIT_COMMIT_LOG
, 中间构建步骤忽略, 我在最后一步 通过qq 机器人 发送 消息到群里 内容就是GIT_COMMIT_LOG
这样的写法未成功,我看到 你们提供的 android.flow.yml 中ANDROID_OUTPUT_IPA_PATH
有类似的使用, 我尝试模仿着写 但是未成功echo current git log:${GIT_COMMIT_LOG}
这里已经打印出来commit
信息The text was updated successfully, but these errors were encountered: