Skip to content

cake-build/cake-action

Use this GitHub Action with your project

Add this Action to an existing workflow or create a new one.

View on Marketplace
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Cake for GitHub Actions

GitHub Marketplace GitHub Actions Build GitHub Actions Tests Coveralls

This action allows you to run a Cake script from your GitHub Actions workflow without having to use a bootstrapper.

Usage

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@v1

The 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.

Inputs

script-path

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.cake

target

You'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-Run

verbosity

You 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: Diagnostic

The supported verbosity levels are Quiet, Minimal, Normal, Verbose and Diagnostic. The default level is set to Normal.

dry-run

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: true

When 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.

arguments

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: Release

The 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).

cake-version

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.0

If 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-manifest

cake-bootstrap

If 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: true

Cross-platform

Since 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: Build

You can read more about how to define a build matrix in the workflow syntax for GitHub Actions.