我想创建一个在 Windows 中设置环境的 GitHub 操作,运行一些 Powershell 命令。尽管这可以作为一个步骤轻松完成,但似乎没有办法为此创建完整的 GitHub 操作。如果我使用这个:
name: 'Rakudo Star fix for windows'
description: 'Updates zef for RakudoStar'
author: 'JJ'
runs:
using: 'node12'
main: 'upgrade.ps1'
Run Code Online (Sandbox Code Playgroud)
除了 JS 脚本之外,似乎没有其他方法可以运行任何东西,甚至没有办法声明环境。我知道这在工作步骤中留待以后使用,但无论如何它看起来像一个黑客。有什么我在这里想念的吗?
我正在将 Nuget 包从 GitHub 操作工作流(下面列出的 .yml 文件)发布到 GitHub 包。
C# 项目文件 PropertyGroup:
如下所示,项目的.csproj文件不包含值VersionSuffix:
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<LangVersion>latest</LangVersion>
<VersionPrefix>1.4.0</VersionPrefix>
<Version>1.4.0</Version>
<PackageVersion>1.4.0</PackageVersion>
<VersionSuffix></VersionSuffix>
<InformationalVersion>This is a package.</InformationalVersion>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)
GitHub 操作工作流 .yml 文件:
name: Build, Pack, Publish
on: [push]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.109
- name: dotnet build
run: dotnet build --configuration Release
- name: Install NuGet client
uses: warrenbuckley/Setup-Nuget@v1
- name: Add private GitHub registry to …Run Code Online (Sandbox Code Playgroud) 这个问答式问题的原因:我花了几个小时才运行它,因为我有一些拼写错误,并认为解决方案更复杂。如果我能在 google 或 Stackoverflow 上找到这样的教程,我会检查拼写错误。
Git 存储库设置:
A- 名称:repoAB(公共存储库) - 名称:repoB目标:
gradle build在repository A > Github ActionsGithub 操作工作流
name: Test
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
Run Code Online (Sandbox Code Playgroud)
问题:
actions/checkout@v1步骤访问子模块失败.gitmodules
[submodule "library"]
path = library
url = git@github.com:organization/repoB.git
Run Code Online (Sandbox Code Playgroud)
Github 操作步骤Build with Gradle错误
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies …Run Code Online (Sandbox Code Playgroud) 我有一个在拉取请求上触发的 github 操作工作流。我想找到在每次提交中已更改的文件,因此我正在尝试运行git diff-tree --no-commit-id --name-only -r ${{ github.sha }}
但是它不会返回该拉取请求中最新提交的哈希提交。我返回了另一个哈希提交(我在我的仓库中的任何地方都找不到它的提交)。
任何人都知道如何解决这个问题或以其他方式我可以在拉取请求中找到在提交中更改的所有文件?
编辑——yml文件
name: test
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- checkout my repo
- install python
- run a python script
run: |
CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }})
python3 .github/scripts/test.py $CHANGED_FILES
Run Code Online (Sandbox Code Playgroud)
我的 github.sha 生成的哈希提交(这里是 ^)似乎与我提交的实际哈希不匹配。
我对 DevOps 的世界真的很陌生,我想把我的脚趾浸入水中。这就是为什么我一直在尝试设置一个简单的 GitHub Action,当我推送到 master 时,我的站点会自动部署到 Firebase,但在构建阶段出现问题:
Run npm run build
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/runner/work/ChezMout/ChezMout/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/runner/work/ChezMout/ChezMout/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2020-01-12T12_04_27_341Z-debug.log
##[error]Process completed with exit code 254.
Run Code Online (Sandbox Code Playgroud)
这是我的基本工作流程:
name: …Run Code Online (Sandbox Code Playgroud) 我使用 NUnit 框架来测试我的 .NET 项目。我想通过 GitHub Actions 运行我的测试。
我的项目的程序集应该包括什么?也许有一些标准的例子?
我只想在代码被推送到特定分支并且标签存在时触发 Github 工作流,但我的配置(github 工作流)没有按预期工作:
name: Deployment
on:
push:
branches:
- feature/BRANCH-NAME
tags:
- *
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Install dependencies
run: |
npm install
- name: Lint & build
run: |
npm run build
Run Code Online (Sandbox Code Playgroud)
即使标签不存在,也会触发工作流。
我怎么能解决这个问题?
我有一个如下所示的 github 存储库
约翰多/你好世界
我正在尝试在 github 操作中设置以下环境变量
env:
DOCKER_HUB_USERID: ${{ github.actor }}
REPOSITORY_NAME: ${GITHUB_REPOSITORY#*\/}
IMAGE_NAME_CLIENT: "$REPOSITORY_NAME-client"
IMAGE_NAME_SERVER: "$REPOSITORY_NAME-server"
Run Code Online (Sandbox Code Playgroud)
我对这些变量的预期结果是:
johndoe
hello-world
hello-world-client
hello-world-server
Run Code Online (Sandbox Code Playgroud)
但我得到
johndoe
${REPOSITORY_NAME#*\/}
$REPOSITORY_NAME-client
$REPOSITORY_NAME-server
Run Code Online (Sandbox Code Playgroud)
看起来在声明envvars 时没有评估表达式。
我怎样才能达到预期的行为?
pipeline github environment-variables github-actions building-github-actions
我有一个简单的工作流定义来进行 Xcode 工作区构建和测试:
name: Swift iOS application
on: pull_request
jobs:
test:
name: Test
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,id=DEC5E859-67C9-4939-87A5-E749D824E541', 'platform=iOS Simulator,id=458AD46E-58ED-4016-875A-70965C6EC869']
steps:
- name: Checkout
uses: actions/checkout@master
- name: Build and Test
run: |
ls -al
pod install --repo-update --clean-install
ls -al
echo "destination=${destination}"
xcodebuild clean test -workspace iosapp.xcworkspace -scheme iosapp -destination "${destination}" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO
env:
destination: ${{ matrix.destination }}
Run Code Online (Sandbox Code Playgroud)
build 命令在我的笔记本电脑上本地成功,但在 Github Actions 运行时失败。这是更多的错误上下文:
Ditto /Users/runner/Library/Developer/Xcode/DerivedData/iosapp-emrlpxjejtcsbjdrjgmowfxebepf/Build/Products/Debug-iphonesimulator/iosapp.swiftmodule/i386-apple-ios-simulator.swiftdoc /Users/runner/Library/Developer/Xcode/DerivedData/iosapp-emrlpxjejtcsbjdrjgmowfxebepf/Build/Intermediates.noindex/iosapp.build/Debug-iphonesimulator/iosapp.build/Objects-normal/i386/iosapp.swiftdoc (in target 'iosapp' from project 'iosapp')
cd /Users/runner/runners/2.165.2/work/ios-app/ios-app
/usr/bin/ditto -rsrc …Run Code Online (Sandbox Code Playgroud) 我想设置一个 github 操作,当它被推送到 master 时,它会在 repo 上从 pandoc FAQ运行这个命令。我们的目标是使用 pandoc docker 容器将我们 repo 中的所有 md 文件从 md 转换为另一种格式。
这是我到目前为止的地方。在第一个示例中,我没有声明入口点,并且收到错误“/usr/local/bin/docker-entrypoint.sh: exec: line 11: for: not found”。
name: Advanced Usage
on:
push:
branches:
- master
jobs:
convert_via_pandoc:
runs-on: ubuntu-18.04
steps:
- name: convert md to rtf
uses: docker://pandoc/latex:2.9
with:
args: |
for f in *.md; do pandoc "$f" -s -o "${f%.md}.rtf"; done
Run Code Online (Sandbox Code Playgroud)
在第二个例子中我们声明entrypoint: /bin/sh,结果是错误“/bin/sh: can't open 'for': No such file or directory”
name: Advanced Usage
on:
push:
branches: …Run Code Online (Sandbox Code Playgroud)