我维护一个lerna / yarn monorepo。我正在将CI / CD从圈子迁移到新的GitHuba Actions发布beta。我创建了以下工作流程:
name: CD
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Checkout master
run: git checkout master
- name: Install rsync
run: sudo apt install rsync
- name: Install yarn
run: |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn
- name: Install Packages
run: yarn install
- name: Test
run: …Run Code Online (Sandbox Code Playgroud) 我想priv_gem_a通过github操作在gem上运行rspec(称之为)。
priv_gem_a取决于私人仓库中的另一个宝石(称为priv_gem_b)。但是priv_gem_b由于权限无效,我无法捆绑安装。
错误:
Fetching gem metadata from https://rubygems.org/..........
Fetching git@github.com:myorg/priv_gem_b
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Host key verification failed.
Retrying `git clone 'git@github.com:myorg/priv_gem_b' "/opt/hostedtoolcache/Ruby/2.6.3/x64/lib/ruby/gems/2.6.0/cache/bundler/git/priv_gem_b-886cdb130fe04681e92ab5365f7a1c690be8e62b" --bare --no-hardlinks --quiet` due to error (2/4): Bundler::Source::Git::GitCommandError Git error: command `git clone 'git@github.com:myorg/priv_gem_b' "/opt/hostedtoolcache/Ruby/2.6.3/x64/lib/ruby/gems/2.6.0/cache/bundler/git/priv_gem_b-886cdb130fe04681e92ab5365f7a1c690be8e62b" --bare --no-hardlinks --quiet` in directory /home/runner/work/priv_gem_a/priv_gem_a has failed.
Run Code Online (Sandbox Code Playgroud)
我认为这与跑步者无法访问同一组织中不同的私有存储库有关。
因此,我尝试将环境变量添加到我的工作流文件include GITHUB_TOKEN,但这不起作用:
name: Test Code …Run Code Online (Sandbox Code Playgroud) 有没有办法访问在Github Action中推送的当前标签?在CircleCI中,您可以使用$CIRCLE_TAG变量访问此值。
我的工作流程Yaml由类似这样的标签触发:
on:
push:
tags:
- 'v*.*.*'
Run Code Online (Sandbox Code Playgroud)
我想在以后的工作流程中将该版本号用作文件路径。
我正在尝试编写一个工作流程,让标签创建工作流程填充我的 GitHub 项目版本。
我已经知道如何创建版本(使用actions/create-release@v1.0.0)以及如何在版本中推送工件(使用actions/upload-release-asset)。
但是,由于我正在构建 Rust 代码,因此我必须在不同的平台上编译它。显然,为此,我在每个平台上都有一份工作,并且我正在努力将我的工件推向该工作。
但为了让推送工作,我必须使用 给出的发布标识符actions/create-release@v1.0.0,它在另一个作业中运行。
因此我的问题是:如何将发布 URL 从发布创建作业传递到将推送工件的作业?
完整的工作流程可以在这里找到:https://github.com/Riduidel/rrss2imap/blob/master/.github/workflows/on_tag.yml
我把它复制在这里
name: Push release artifacts on tag
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
Make_GitHub_Release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
Standard_OS_build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix: …Run Code Online (Sandbox Code Playgroud) 我们使用 GitHub Actions 进行项目的多模块 Maven CI 构建(位于https://github.com/ibm/fhir )。
我们有:
我发现我可以通过定义多个工作流程并使用内置on.pull_request.paths属性来完成类似的事情,如下所示: https ://help.github.com/en/actions/automating-your-workflow-with-github-actions/ github-actions 的工作流程语法#onpushpull_requestpaths
我想知道我是否/如何能够在job或step级别上完成类似的事情。我发现作业支持基于https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idif的条件执行,但我可以'不知道是否有任何东西可以帮助获得与该on.pull_request.paths功能类似的行为。
假设没有,有人找到了可以帮助解决这个问题的行动吗?或者也许有人可以指出我该功能的实现on.pull_request.paths?
我正在尝试创建一个基于 Dockerfile 的操作,该操作将一个程序添加到 中$PATH,以便以后的操作可以使用它。我的操作运行如下代码:
mkdir -p $GITHUB_WORKSPACE/bin\necho "echo Hello, world!" > $GITHUB_WORKSPACE/bin/hello-world\necho "::add-path::$GITHUB_WORKSPACE/bin"\nRun Code Online (Sandbox Code Playgroud)\n\n我的测试工作流程使用如下:
\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v1.0.0\n - name: Add program to path\n uses: ./\n - name: Use program\n run: hello-world\nRun Code Online (Sandbox Code Playgroud)\n\n这会失败,因为虽然程序已添加到操作中的$GITHUB_WORKSPACE/bin/hello-world值,但工作区步骤中的值不同。$GITHUB_WORKSPACE
在action中是\xc2\xa0 /github/workspace/,而在workflow中是/home/runner/work/setup-gleam/setup-gleam/,所以$PATHaction设置的加法不正确。
如何从基于 dockerfile 的 GitHub 操作将文件添加到目录,以便它位于工作流程其余部分的路径上?$PATHdockerfile 操作和非 dockerfile 操作之间似乎没有共享可写目录。
我正在尝试使用 GitHub Actions 在 Github 中为我的私有 Swift 项目设置 CI。我使用了 Github 提供的标准 swift.yml 模板并进行了一些修改。这是文件ci.yml
name: Swift
on: [push]
jobs:
build:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- name: Run tests
run: xcodebuild -project 'MyApp.xcodeproj' -scheme 'MyApp' -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=13.2' clean test
- name: Build App
run: xcodebuild -project 'MyApp.xcodeproj' -scheme 'MyApp' -destination 'generic/platform=iOS' -configuration Release build CODE_SIGNING_ALLOWED=NO
Run Code Online (Sandbox Code Playgroud)
当我将新版本推送到存储库时,操作会触发,但测试失败。
xcodebuild -project 'MyApp.xcodeproj' -scheme 'MyApp' -destination 'platform=iOS Simulator,name=iPhone 11 Pro Max,OS=latest' clean test
Run Code Online (Sandbox Code Playgroud)
我在本地运行并且所有测试都通过了。在 GitHub Actions 上,我遇到了此错误
Set up …Run Code Online (Sandbox Code Playgroud) Github 最近添加了用于 CI 测试的操作按钮。
但是,我不想在本地未通过 CI 的情况下推送代码。
如何ccpp.yml在本地测试我的代码?
是否可以拆分 GitHub Actions 工作流程文件并从其他文件引用它?我需要将应用程序部署到多个环境(即暂存和生产)中,并且希望共享一半的步骤以最大程度地减少维护。
我们以此工作流程为例,它基于NodeJS 启动工作流程。
name: continues integration workflow
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v1
with:
node-version: '13.x'
- run: npm test
env:
CI: true
Run Code Online (Sandbox Code Playgroud)
设置的目的是什么CI: true?
github-actions ×10
github ×5
c++ ×1
docker ×1
git ×1
github-api ×1
ios ×1
lerna ×1
maven ×1
release ×1
ruby ×1
rubygems ×1
swift ×1
xcodebuild ×1