This action allows you to run a Cake script from your GitHub Actions workflow without having to use a bootstrapper.
Using the Cake action from a GitHub Actions workflow is as simple as referencing this repository from a build step:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1The Cake action will look for a script named build.cake in your repository's root directory and run it for you using the Cake Tool. All output from the Cake script will be automatically redirected to the build log for inspection.
If your script is in another location, you can specify the path with the script-path input parameter:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
script-path: path/to/script.cakeYou'll likely want to specify which task to run out of the ones defined in the Cake script. For that, you can use the target parameter:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
target: Task-To-RunYou can adjust the amount of information Cake sends to the build log by changing the verbosity level with the verbosity parameter:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
verbosity: DiagnosticThe supported verbosity levels are Quiet, Minimal, Normal, Verbose and Diagnostic. The default level is set to Normal.
While developing a script, you'll sometimes want to see which tasks would be triggered by a given target without actually running them. That's exactly what the dry-run parameter is for:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
dry-run: trueWhen dry-run is set to true, Cake will print out the names of the tasks to run according to the dependency graph, but it won't perform any of the instructions defined in them.
If your script defines any custom parameters, you can specify arguments for them by using the arguments parameter:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
arguments: |
name: value
configuration: ReleaseThe arguments are defined in a multi-line string literal where each argument is on a separate line in the format name: value. Keep in mind that the values you specify here are passed as is to the Cake script; this means that characters like quotes are kept intact (for example, name: 'value' will result in --name='value' being passed to the script).
By default, the Cake action will run your script using the latest stable version of the Cake .NET Core Global tool. However, if for some reason you want to use a specific version of Cake (for compatibility with older third-party addins, for example), you can do so by specifying the version number in the cake-version parameter:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
cake-version: 0.30.0If you're pinning your Cake version using a tool manifest file, then you can have the action restore any local tools, including Cake, by specifying tool-manifest as the argument for cake-version:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
cake-version: tool-manifestIf you're referencing any custom modules from within your script, you'll have to bootstrap them before the script runs. The Cake action can do this extra step for you; all you have to do is set the cake-bootstrap parameter to true:
steps:
- name: Run the Cake script
uses: cake-build/cake-action@v1
with:
cake-bootstrap: trueSince the Cake Tool is built on .NET Core, the Cake action will run on any of the virtual environments supported by GitHub Actions, namely Linux, Windows and macOS.
This allows you to define your build step exactly once and run it on multiple operating systems in parallel by defining a build matrix:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macOS-latest]
steps:
- name: Get the sources
uses: actions/checkout@v1
- name: Run the build script
uses: cake-build/cake-action@v1
with:
target: BuildYou can read more about how to define a build matrix in the workflow syntax for GitHub Actions.