Mai*_*rey 21 continuous-integration github-actions
今天我要讨论的话题是Github Actions。我对CI这个话题不熟悉。
在 GitHub 我想创建一个操作。我暂时使用GitHub的样板。我不明白ubuntu-latest jobs: build: runs-on: ubuntu-latest是什么意思。在另一个教程中我看到了自托管。我要部署的服务器上也是ubuntu,但是那跟它没关系吧?
非常感谢您的回答、反馈、评论和想法。
GitHub 工作流程 yml
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!
# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
Run Code Online (Sandbox Code Playgroud)
Gui*_*urd 20
这runner是从 GitHub Actions 工作流运行作业及其步骤的应用程序。
它由托管虚拟环境中的 GitHub Actions 使用,或者您也可以在自己的环境中自行托管运行器。
基本上,GitHub 托管的运行器提供了一种更快、更简单的方式来运行工作流,而自托管的运行器是一种在您自己的自定义环境中运行工作流的高度可配置的方式。
引用Github文档:
GitHub-hosted runners:
- Receive automatic updates for the operating system, preinstalled packages and tools, and the self-hosted runner application.
- Are managed and maintained by GitHub.
- Provide a clean instance for every job execution.
- Use free minutes on your GitHub plan, with per-minute rates applied after surpassing the free minutes.
Self-hosted runners:
- Receive automatic updates for the self-hosted runner application only. You are responsible for updating the operating system and all other software.
- Can use cloud services or local machines that you already pay for.
- Are customizable to your hardware, operating system, software, and security requirements.
- Don't need to have a clean instance for every job execution.
Are free to use with GitHub Actions, but you are responsible for the cost of maintaining your runner machines.
Run Code Online (Sandbox Code Playgroud)
您还可以在上面共享的链接上看到下表,其中显示了可用的 Github 托管运行器及其关联标签(例如ubuntu-latest):
因此,当您告知ubuntu-latest您的工作流程时,您要求 Github 提供一个运行程序来执行作业实现中包含的所有步骤(它与您希望部署的服务器无关,而是与将执行部署操作的管道相关)你的情况))。
| 归档时间: |
|
| 查看次数: |
19636 次 |
| 最近记录: |