了解工作流程

已完成

工作流程會定義所需的自動化。 並且會詳細說明應該觸發工作流程的事件。

此外還會定義觸發工作流程時應該執行的作業。

作業會定義要執行動作的位置,例如要使用哪一個執行器。

工作流程以 YAML 撰寫,並位於 .github/workflows 位置的 GitHub 存放庫內。

範例工作流程:

# .github/workflows/build.yml
name: Node Build.

on: [push]

jobs:
    mainbuild:
 
        runs-on: ${{ matrix.os }}
     
    strategy:
        matrix:
            node-version: [12.x]
            os: [windows-latest]
         
    steps:

    - uses: actions/checkout@v1
    - name: Run node.js on latest Windows.
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}

    - name: Install NPM and build.
      run: |
        npm ci
        npm run build

您可以在這裡找到一組入門工作流程: 入門工作流程

您可以在這裡看到工作流程的可用語法:GitHub Actions 的工作流程語法