创建 GitHub 个使用 powershell 脚本的操作
Create GitHub actions that use powershell scripts
我想创建一个 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。我在这里遗漏了什么吗?
您也可以 运行 docker 直接使用 .ps1 脚本的入口点
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 作为基础环境。
我想创建一个 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。我在这里遗漏了什么吗?
您也可以 运行 docker 直接使用 .ps1 脚本的入口点
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 作为基础环境。