Updated on 2024-11-21 GMT+08:00

Running Shell Commands

You can use the action Run Shell Commands to create and run a build task. You can also use this action in conjunction with other build tools. For instance, in a Maven build, you can add the Run Shell Commands action to generate the necessary files for the subsequent build process.

Build on GUI

Add Run Shell Commands, when configuring build actions. Set the parameters according to Table 1.

Table 1 Parameters for running shell commands

Parameter

Description

Action Name

Assign a custom name to the build action. The name can contain:

  • Letters, digits, hyphens (-), underscores (_), commas (,), semicolons (;), colons (:), periods (.), slashes (/), and parentheses.
  • 1 to 128 characters.

Tool Version

Select a tool version that matches your current development environment.

For tool versions supported by CodeArts Build, see build tools and versions. If the current tools and versions do not meet your requirements, you can customize a build environment.

Commands

Enter the shell commands for your build.

Build with Code

Modify the code in the PRE_BUILD block in Creating a YAML File for Your Code-based Build by referring to the following sample code:

1
2
3
4
5
6
version: 2.0 # The value must be 2.0.
steps:
  PRE_BUILD:
    - sh:
        inputs:
          command: echo ${a}
Table 2 Parameters in the sample code

Parameter

Type

Description

command

String

Enter the shell commands for your build.