ubuntu-latest 对 GitHub 操作意味着什么?

What does ubuntu-latest mean for GitHub Actions?

今天我要处理的话题是Github 动作。我不熟悉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.

runner 是 运行 作业及其来自 GitHub 操作工作流程的步骤的应用程序。

它在您自己的环境中被 hosted virtual environments, or you can self-host the runner 中的 GitHub 操作使用。

基本上,GitHub-托管 运行ners 提供了一种更快、更简单的方法来 运行 您的工作流程,而自托管 运行ners 是一种高度可配置的方式在您自己的自定义环境中 运行 工作流。

引用 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.

您还可以在 link 上面的共享中看到以下 table 显示可用的 Github 托管 运行 用户及其相关标签(比如ubuntu-latest):

因此,当您告知 ubuntu-latest 您的工作流程时,您要求 Github 提供一个 运行ner 来执行您的作业实施中包含的所有步骤(它与您希望部署的服务器,但要执行部署操作的管道(在您的情况下))。