I将STM32 CubRogrammer与github动作集成为部署。
尽管有错误的命令退出,但GitHub Action Workflow并没有失败,因此结果是成功的。由于控制台日志上的命令打印“错误”,我只想抓取此功能并使工作流失败。我该怎么办?
我正在使用自主跑步者(Windows 10)
jobs:
build:...
deployment:
# The type of runner that the job will run on
runs-on: [ self-hosted, deploy ]
needs: build
environment: production
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a set of commands using the runners shell
- name: deploy
run: |
STM32_Programmer_CLI.exe -c port=SWD -w ${{ secrets.ELF_FILE }} ${{ secrets.START_ADDR }}
- name: start
run: |
STM32_Programmer_CLI.exe -c port=SWD -c port=SWD -s ${{ secrets.START_ADDR }}
i保存输出并使用
使用正则表达式
jobs:
build:...
deployment:
# The type of runner that the job will run on
runs-on: [ self-hosted, deploy ]
needs: build
environment: production
outputs:
result: ${{ steps.deploy.outputs.DEPLOY_RESULT }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: deploy
# based on Windows Powershell batch script language
run: |
$deploy_result = $(STM32_Programmer_CLI.exe -c port=SWD -w ${{ env.ELF_FILE }} ${{ env.START_ADDR }})
echo $deploy_result
if ( $deploy_result -match "File download complete" ) {} else { exit 1 }