我有这个 GitHub 操作作业来构建 Docker 映像并将其发布到 GitHub 注册表。
...
jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile
registry: docker.pkg.github.com
repository: myrepo/myimg
tag_with_ref: true
Run Code Online (Sandbox Code Playgroud)
但是它在父目录中运行,而我Dockerfile的在里面app/。
.
|- .github/workflow/ci.yaml
|- README
|- app/
|- Dockerfile
|- package.json
|- package.lock.json
|- node_modules/
|- src/
|- ...
Run Code Online (Sandbox Code Playgroud)
我尝试设置working-directory: …
我正在尝试用 Github Actions 取代我们 iOS 项目糟糕的 Jenkins 设置。我想我已经准备好了所有的部分,但我遇到了一个我不明白的失败。在我运行构建和测试应用程序的步骤中xcodebuild,我收到了一个xcpretty未知命令的错误,尽管在上一步中是通过捆绑程序安装的。以下是相关文件:
构建并运行.yml
---
name: Build & Test
on:
# Run tests when a PR merges.
push:
branches:
- develop
# Run tests when PRs are created or updated.
pull_request:
types: [opened, synchronize, reopened]
# Allow the workflow to be run manually.
workflow_dispatch:
env:
DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer
jobs:
test:
name: Build & Test
runs-on: 'macos-latest'
steps:
- name: Checkout Project
uses: actions/checkout@v2
with:
ref: develop
- name: Setup Ruby
uses: ruby/setup-ruby@v1.46.0 …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建网络流程以在 Play 商店上发布应用程序。
这是代码:
- name: Upload to Google Play
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: ${{ SERVICE_ACCOUNT_JSON }}
packageName: packagename
releaseFile: app/release/app.aab
track: internal
whatsNewDirectory: distribution/whatsnew
Run Code Online (Sandbox Code Playgroud)
但无法理解如何在 serviceAccountJson 键处传递 JSON 服务帐户文件位置?
我需要将文件存储在本地并传递路径还是需要将文件添加到Github Secret中?
github google-play google-play-developer-api google-play-console github-actions
我有一个 Github 存储库,其中包含一些 Linux 实用程序。
为了运行测试,我使用 GitHub 操作和一些简单的自定义工作流程,这些工作流程使用自托管运行器在远程 Linux 服务器上运行:
name: CMake
on: [push]
env:
BUILD_TYPE: Release
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Build
working-directory: ${{runner.workspace}}/Utils
shell: bash
run: cmake --build . --config $BUILD_TYPE
- name: Run test
working-directory: ${{runner.workspace}}/Utils
shell: bash
run: ./testing/test.sh
Run Code Online (Sandbox Code Playgroud)
工作流程非常简单 - 我使用编译源代码cmake,然后运行来自同一存储库的脚本来测试构建。测试脚本是一个 bash 脚本,如下所示:
#!/bin/bash
export LD_LIBRARY_PATH=/path/to/bin
cd /path/to/bin
echo -e "Starting the tests"
./run_server &
./run_tests
if [ $? -eq 0 ]; then
echo "successful"
else
echo "failed" …Run Code Online (Sandbox Code Playgroud) 我有 github 操作工作流程,概述了启动 terraform 以在 Azure 中创建资源的简单过程。我缺少的是如何集成 terraform 状态文件,以便在顺序运行此工作流程时,它应该将当前状态与 main.tf 文件进行比较,并且只允许净更改。目前,如果我按顺序运行此命令,第二次总是会失败,因为资源已经在 Azure 中创建。
如何配置下面的 github 工作流程以允许 terraform 状态文件比较?,我还没有找到执行此操作的单个来源
github操作工作流程:
name: Terraform deploy to Azur
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@master
- name: "Terraform Init"
uses: hashicorp/terraform-github-actions@master
with:
tf_actions_version: 0.12.13
tf_actions_subcommand: "init"
- name: "Terraform Plan"
uses: hashicorp/terraform-github-actions@master
with:
tf_actions_version: 0.12.13
tf_actions_subcommand: "plan"
args: -var="client_secret=${{ secrets.clientSecret }}"
-var="client_id=${{ secrets.clientId }}"
-var="tenant_id=${{ secrets.tenantId }}"
-var="sub=${{ secrets.sub }}"
- name: "Terraform Apply"
uses: hashicorp/terraform-github-actions@master
with: …Run Code Online (Sandbox Code Playgroud) 在我的 github 项目中,每当有东西被推送到 master 分支时,我都会尝试自动创建一个新版本并将其发布到 NPM。
这个想法
我正在使用 github 操作。我的工作流程文件如下所示:
# This workflow will run tests using node and then publish a package to the npm registry when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
name: Node.js Package
on:
#trigger on every commit to the main branch
push:
branches:
- main
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm test
publish-npm:
needs: build …Run Code Online (Sandbox Code Playgroud) continuous-integration npm github-actions building-github-actions
我正在将 EC2 作为自托管运行器运行。我已将 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY 导出到 EC2,我可以看到它们是用printenv命令设置的。
这样做的原因是我不想将 AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY 保存在 github 秘密中。
有什么方法可以在我的 github 操作工作流程中访问和使用环境变量(AWS_ACCESS_KEY_ID 和 AWS_SECRET_ACCESS_KEY)?
continuous-integration amazon-ec2 devops github-actions cicd
下面显示了典型构建的 Github Actions 选项卡显示的内容:
构建步骤实际上有许多子步骤,但我不想使用 Github Actions 作为脚本语言,只是为了能够谨慎地显示每个子步骤。Github Actions 是否提供了某种魔力来表明您希望构建的可视化显示离散步骤(即“动态步骤”)?
我希望出现类似以下内容的内容,这会导致在 Github Actions 构建可视化的输出中创建离散结果节点:
- name: Dynamic Steps
run |
echo "###github-action-step: Step 1"
echo "###github-action-step: Step 2"
echo "###github-action-step: Step 3"
Run Code Online (Sandbox Code Playgroud) 我正在使用 GitHub actions 来管理我的 CI,以下事件会触发我的工作流程:
on:
pull_request:
branches: main
push:
branches: main
Run Code Online (Sandbox Code Playgroud)
我观察到以下“问题”:当我创建 PR 时,CI 就会运行。如果测试通过并且我将其合并到 main 中,则会再次运行测试(在特定情况下我不希望这样做)。如何设置我的工作流程,以便在合并 PR(CI 已通过 PR)时不会触发 CI?
提前致谢!
我有一个工作流程步骤,循环运行 shell 命令的最后阶段:
|| echo "::error Filename $filename doesn't match possible files" && exit 1 ; done
退出被适当触发,但我看到的唯一注释是:
错误:进程已完成,退出代码为 1。
日志显示了整个 shell 命令管道以及相同的错误消息,但不是我的回显错误。
如何获取我的输出,包括 $filename 变量?
github-actions ×10
github ×4
amazon-ec2 ×1
cicd ×1
devops ×1
docker ×1
dockerfile ×1
google-play ×1
ios ×1
npm ×1
rubygems ×1
terraform ×1
xcodebuild ×1