我正在尝试在分支上触发我的管道develop。
该代码有效:
name: develop
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build Debug version
run: |
chmod +x pipelines.sh
./pipelines.sh "build"
Run Code Online (Sandbox Code Playgroud)
此代码不起作用:
name: develop
on:
push:
branches:
- 'develop'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build Debug version
run: |
chmod +x pipelines.sh
./pipelines.sh "build"
Run Code Online (Sandbox Code Playgroud)
我总是有这样的错误消息:
jobs …
到目前为止,我的 YML 不断根据其他 stackoverflow 线程 + 文档添加位:
name: Node install, build and test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Create NPMRC
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN}}
- name: Publish to Github Packages
run: |
npm config set _auth $NODE_AUTH_TOKEN
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN}}
Run Code Online (Sandbox Code Playgroud)
在我的 package.json 中,我有:
"publishConfig": { …Run Code Online (Sandbox Code Playgroud) 我知道 Webhook 用于从托管 git 存储库触发服务器端操作,CI/CD 代表托管 git 存储库的持续集成和持续部署/交付,但关键区别是什么,特别是当它们都是时由单个 git 托管服务提供商(如 GitLab 或 GitHub)提供吗?(对于 GitLab,这些指的是 Webhooks 和 CI/CD,而对于 GitHub,这些指的是 Webhooks 和 GitHub Actions。)
文档模糊地详细说明了 Webhook 如何以及如何用于触发 CI/CD,但与此同时,即使没有将显式 Webhook 添加到 git 存储库,供应商提供的 CI/CD 也可以运行。这是否意味着每个使用供应商提供的 CI/CD 的托管 git 存储库背后都有一个 Webhook?
我从上面的理解是,显式 Webhooks(与底层 Webhook 相反)可用于触发第 3 方 CI/CD,而 git 托管服务提供商的 CI/CD 是由同一方托管和运行的。它是否正确?
非常感谢发布答案的人。
git continuous-integration webhooks continuous-deployment github-actions
我只想在特定工作流程完成时触发工作流程...有人知道该怎么做吗?
一些背景:
Tests,另一个称为Build-feature.Tests我在每个 PR 到分支上运行我的工作流程feature。feature,那么我想运行工作流程Tests,并且只有当成功时我才想运行Build-feature工作流程。还有一个事件check_suite应该触发工作流程:https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#check-suite-事件检查套件
我尝试了这个例子:
on:
check_suite:
types: [rerequested, completed]
Run Code Online (Sandbox Code Playgroud)
但我的工作流程从未触发,有什么想法吗?或者关于如何实现上述目标的任何其他想法?
continuous-integration github continuous-deployment devops github-actions
我为 CI/CD 设置了 Github Actions,但我在数据库连接方面遇到了困难。
由于sequelize允许指定另一个数据库url(使用“use_env_variable”选项),我更新了我的配置,如下所示:
{
"test": {
"dialect": "postgres",
"schema": "exercises_library",
"logging": false,
"use_env_variable": "DATABASE_URL"
},
"production": {
"dialect": "postgres",
"schema": "exercises_library",
"logging": false,
"use_env_variable": "DATABASE_URL"
}
}
Run Code Online (Sandbox Code Playgroud)
所以我在 Github Actions 中编写了我的工作流程:
name: Source Code CI/CD
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
ci:
runs-on: ubuntu-latest
container:
image: node:12
services:
# More explanation about that here :
# https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml
postgres:
image: postgres:12-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: jy95
POSTGRES_DB: sourcecode
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval …Run Code Online (Sandbox Code Playgroud) 我正在努力创建一个 github 操作来创建发布草案。在操作中,如果应用程序版本没有相应的 git 标签,我只想运行发布代码
当前的操作 yaml 类似于:
# ...
jobs:
# test, winbuild and linuxbuild jobs
draftrelease:
needs: [test, winbuild, linuxbuild]
runs-on: ubuntu-latest
# if ${{jobs.test.steps.appversion.outputs.version}} is not a tag
steps:
# ...
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用以下命令来打印标签是否存在,但我需要检查 if 中标签是否不存在:
git show-ref --tags --verify -- "refs/tags/${{jobs.test.steps.appversion.outputs.version}}"
Run Code Online (Sandbox Code Playgroud)
我该如何将作业设置为仅在jobs.test.steps.appversion.outputs.versions不是 git 标签时运行?
我正在使用此脚本生成带有提交日期的文件
cat .github/workflows/header.md > "COVID 19/fechas.md"
git ls-tree -r --name-only HEAD COVID\ 19/*.csv | while read filename; do
date=$(git log -1 --format="%aD" -- "$filename")
echo "| $date | $filename |" >> "COVID 19/fechas.md"
done
git config --global user.email "jjmerelo@gmail.com"
git config --global user.name "FechaActionBot"
git add "COVID 19/fechas.md"
git commit -m "Fichero de fechas generado"
Run Code Online (Sandbox Code Playgroud)
在此GitHub Action中,它检查代码并作为脚本在上面运行。
无论我使用什么格式(提交者或作者日期),我都会得到相同的结果,它显示所有文件的相同日期(当前日期)。
我一直在推动提交
但是,我得到了错误
* What went wrong:
Execution failed for task ':app:stripReleaseDebugSymbols'.
> No version of NDK matched the requested version 20.0.5594570. Versions available locally: 21.0.6113669
Run Code Online (Sandbox Code Playgroud)
以下是 CI 代码(Flutter CI - 客户):
name: Flutter CI - Customer
on:
push:
branches:
- master
paths:
- holinoti_customer/**
- .github/workflows/flutter-customer.yml
pull_request:
branches:
- master
paths:
- holinoti_customer/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.0.0
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11.0.2
- name: Android …Run Code Online (Sandbox Code Playgroud) continuous-integration github android-ndk flutter github-actions
I\xe2\x80\x99m 尝试为 Python 包设置 GitHub 操作。我相信最明智的方法是我在 GitLab 中使用的 xe2x80x99m ;在 docker 镜像内运行一组命令。我想用一个矩阵来测试多个Python版本。
\n\n到目前为止,我已经定义了以下工作流程:
\n\nname: Pytest\n\non:\n - push\n - pull_request\n\njobs:\n pytest:\n runs-on: ubuntu-latest\n strategy:\n matrix:\n python-version:\n - 3.5\n - 3.6\n - 3.7\n - 3.8\n container: python:${{ python-version }}-alpine\n steps:\n - uses: actions/checkout@v2\n - name: Install\n run: |\n pip install poetry\n poetry install\n - name: PyTest\n run: poetry run pytest\nRun Code Online (Sandbox Code Playgroud)\n\n结果可以在这里看到: https: //github.com/remcohaszing/pywakeonlan/actions/runs/87630190
\n\n这显示以下错误:
\n\n\n\n\n工作流程无效。.github/workflows/pytest.yaml(行:17,列:16):无法识别的命名值:\'python-version\'。位于表达式中的位置 1:python-version
\n
我该如何修复这个工作流程?
\n从我的 docker-compose 文件中我必须读取一个环境变量。在本地,我可以像这样读取该变量:ENV_FILE=.env docker-compose -f docker-compose.dev.prisma.yml up --build
但由于 .env 文件位于 .gitignore 中,GitHub 操作无法获取该文件。我怎样才能阅读它们?
我的 package.json 文件中几乎有同样的问题。我需要从 npm 脚本中读取一些环境变量:
"start:backend": "wait-port $API_HOST:API_PORT && yarn start"
Run Code Online (Sandbox Code Playgroud)
我尝试过将这些变量添加到github的秘密中,但它没有得到这些变量。尽管期望这两个文件,但 envs 可以从 github 操作中完美读取。
github environment-variables docker-compose github-actions building-github-actions
github-actions ×10
github ×5
git ×2
android-ndk ×1
devops ×1
flutter ×1
node.js ×1
postgresql ×1
sequelize.js ×1
webhooks ×1
yaml ×1