我在这里尝试为我的.net项目使用GitHub Actions编写工作流,如下所示:
name: CI
on:
push:
pull_request:
branches:
- '*'
env:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
jobs:
ci_build:
name: Build
runs-on: windows-latest
steps:
- name: NPM Authentication
uses: workflows/checkout@0
- name: Use Node.js
uses: workflows/setup-node@0
- name: Nuget Command
uses: workflows/checkout@master
- uses: nuget/setup-nuget@v1
with:
nuget-api-key: ${{ secrets.NuGetAPIKey }}
- run: nuget restore MyProject.sln
- name: NuGet Tool Installer
run: NuGetToolInstaller@0
- name: NuGet Commad
run: NuGetCommand@2
env:
restoreSolution: '$(solution)'
selectOrConfig: 'config'
nugetConfigPath: 'Build/NuGet.config'
- name: VS Build
run: VSBuild@1
env:
solution: '$(solution)'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
msbuildArgs: /p:AuthenticateWithRegistry=false
- name: VS Test
run: VSTest@2
env:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
testSelector: 'testAssemblies'
testAssemblyVer2: '**\*test*.dll!**\*IntegrationTests.dll!**\*UiTests.dll!**\*TestAdapter.dll!**\obj\**'
- name: Copy Files to - $(build.artifactstagingdirectory)
run: CopyFiles@2
env:
content: |
**\bin\OpenLink365*.zip
**\bin\**\$(buildConfiguration)\*.msi
targetFolder: $(build.artifactstagingdirectory)
flattenFolders: true
但是在执行过程中,我收到了如下所述的错误:
- 当前运行器版本:'2.163.1'
- 准备工作流程目录
- 准备所有必需的操作
- 下载操作存储库'workflows / checkout @ 0'
- [警告]未能下载动作'https://api.github.com/repos/workflows/checkout/zipball/0'。错误响应状态代码未指示成功:404(未找到)。
- [[警告]]在重试之前先退后29.74秒。
- [警告]未能下载动作'https://api.github.com/repos/workflows/checkout/zipball/0'。错误响应状态代码未指示成功:404(未找到)。
- [[warning]先退后29.102秒,然后重试。
- [错误]响应状态代码不指示成功:404(未找到)。
workflows/checkout
指定了0
,但不存在workflows/checkout
存储库。您可能想要actions/checkout
,并且您想指定一个标签,可能是v1
,所以这些行看起来像uses: actions/checkout@v1
。
我不知道有什么工具可以处理用于测试GitHub Actions的新YAML语法,尽管有些工具可以处理可能已更新为支持新语法的较旧HCL语法。 This repository可能具有指向合适工具的链接。