我想创建一个GitHub操作,该操作在Windows中设置环境,并运行一些Powershell命令。尽管可以很容易地做到这一点,但是似乎没有一种方法可以为此创建完整的GitHub动作。如果我使用这个:
name: 'Rakudo Star fix for windows'
description: 'Updates zef for RakudoStar'
author: 'JJ'
runs:
using: 'node12'
main: 'upgrade.ps1'
除了JS脚本,甚至声明环境,似乎没有其他方法可以运行。我知道在工作步骤中还有待解决,但无论如何看起来还是很hack。我在这里想念什么吗?
答案 0 :(得分:3)
您还可以直接使用.ps1脚本的入口点运行docker
FROM ubuntu:18.04
LABEL "com.github.actions.name"="test"
LABEL "com.github.actions.description"="test."
RUN apt-get update \
&& apt-get install wget -y \
&& wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get install -y powershell
ADD test.ps1 /test.ps1
ENTRYPOINT ["pwsh", "/test.ps1"]
更新:
using
字段是用于执行main
中指定的代码的应用程序。但是Github Actions仅支持使用node12
和docker
。从这个GHActions可以看出,我只是为了举例而跑。
Docker无法在大多数Windows环境中运行,您必须使用Windows Server 2019作为基本环境。