Configuration Steps
This document introduces how to configure properties such as command execution, Action calls, environment variables, conditional execution, timeout, and error tolerance in workflow steps (Step).
When you need to define specific execution steps within a job, including running scripts, calling Action plugins, setting environment variables, conditional execution, etc.
Prerequisites
- A job has been defined and
runs-onhas been specified. - Understand the specific operation to be executed (script or Action plugin).
Quick Example
jobs:
build:
name: Build
runs-on: [ubuntu-latest, x64, small]
steps:
- name: Checkout source code
uses: checkout
- name: Setup Node.js
uses: setup-node
with:
node-version: "20"
- name: Install and test
run: |
npm ci
npm test
- name: Print version
env:
APP_VERSION: "1.0.0"
run: echo "version=$APP_VERSION"
Configuration Explanation
id Step Identifier
id is used to uniquely identify a step, and the output of this step can be referenced later using ${{ steps.<id>.outputs.<key> }}:
steps:
- name: Run output
id: version
run: echo "version=1.0.0" >> "$ATOMGIT_OUTPUT"
- name: Print version
run: echo "${{ steps.version.outputs.version }}"
name Step Display Name
name is the display name of the step in logs and interface:
steps:
- name: Install dependencies
run: npm install
uses Call Action Plugin
uses specifies the Action plugin to call, in the format {owner}/{repo}@{ref}:
steps:
- name: Checkout source code
uses: checkout
See Using Action Plugins for details.
with Pass Parameters
with is used to pass input parameters to the Action plugin:
steps:
- name: setup node
uses: setup-node
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"