简体   繁体   English

Github 操作路径未更新

[英]Github Actions path does not update

Right now, I'm trying to build a tool from source and use it to build a C++ project.现在,我正在尝试从源代码构建一个工具并使用它来构建一个 C++ 项目。 I'm able to extract the tar file (gcc-arm-none-eabi).我能够提取 tar 文件 (gcc-arm-none-eabi)。 But, when I try to add it to path (using $GITHUB_PATH , not add-path ), the path doesn't apply on my next action and I can't build the file.但是,当我尝试将其添加到路径时(使用$GITHUB_PATH ,而不是add-path ),该路径不适用于我的下一个操作,并且我无法构建文件。 The error states that it can't find the gcc-arm-none-eabi toolset, which means that it didn't go to path.该错误表明它找不到 gcc-arm-none-eabi 工具集,这意味着它没有 go 到路径。

Here's the script for the entrypoint of the first function (make is ran in the next action to allow for path to apply)这是第一个 function 的入口点的脚本(在下一个操作中运行 make 以允许应用路径)

echo "Downloading ARM Toolchain"
# The one from apt isn't updated so I have to build from source
curl -L https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -o gcc-arm-none-eabi.tar.bz2
tar -xjf gcc-arm-none-eabi.tar.bz2

echo "/github/workspace/gcc-arm-none-eabi-10-2020-q4-major/bin" >> $GITHUB_PATH

I can't even debug by seeing what's in the path because running echo $(PATH) just says that PATH cannot be found.我什至无法通过查看路径中的内容进行调试,因为运行echo $(PATH)只是说找不到 PATH。 What should I do?我应该怎么办?

I can't even debug by seeing what's in the path because running echo $(PATH) just says that PATH cannot be found.我什至无法通过查看路径中的内容进行调试,因为运行echo $(PATH)只是说找不到 PATH。 What should I do?我应该怎么办?

First, PATH is not a command so if you want to print its value, it would be something like echo "${PATH}" or echo "$PATH"首先, PATH不是一个命令,所以如果你想打印它的值,它会像echo "${PATH}"echo "$PATH"

Then, if you want to add a value to an existing environment variable, it would be something like然后,如果您想向现有环境变量添加一个值,则类似于

export PATH="${PATH}:/github/workspace/gcc-arm-none-eabi-10-2020-q4-major/bin"

EDIT: seems not a valid way to add something to the path using Github Actions, meanwhile it seems correct in the question.编辑:似乎不是使用 Github 操作向路径添加内容的有效方法,同时在问题中似乎是正确的。 To get more details: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path .要获取更多详细信息: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path Thanks to Benjamin W. for pointing this out in the comments.感谢 Benjamin W. 在评论中指出这一点。

Finally I think it would be a better fit if you use a docker image that already contains that kind of dependancies (you could easily write your own Dockerfile if this image doesn't already exists).最后,我认为如果您使用已经包含这种依赖关系的 docker 图像会更合适(如果此图像尚不存在,您可以轻松编写自己的 Dockerfile)。 Github action is designed to use docker (or OCI containers) image that contains the dependancies you need to perform your build actions. Github 操作旨在使用包含执行构建操作所需的依赖项的 docker(或 OCI 容器)映像。 You should take a look here: https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/dockerfile-support-for-github-actions你应该看看这里: https://docs.github.com/en/free-pro-team@latest/actions/creating-actions/dockerfile-support-for-github-actions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM