Guides

Taskfile

Taskfiles are a way to define tasks that can be run with the `task` command. They are written in YAML and can be used to automate common tasks such as building, testing, and deploying your application.

Installation

These installation methods are maintained by the Task team and are always up-to-date.

Ubuntu

First setup the repository:

bash
curl -1sLf 'https://dl.cloudsmith.io/public/task/task/setup.deb.sh' | sudo -E bash

Next, install the package:

bash
sudo apt install task

Usage

The following guide will help introduce you to the basics of Task. We'll cover how to create a Taskfile, how to write a basic task and how to call it.

Creating a Taskfile

To use Task, you need to create a Taskfile.yml in the root of your or you can run task --init to generate one for you. This file defines the tasks that you can run with the task command.

Calling a Task

To call a task, you can use the task command followed by the name of the task you want to run. For example, if you have a task called build, you can run it with the following command:

bash
task build

Samples

Here are some sample Taskfiles to help you get started

Docker

yaml
version: '3'

  tasks:
    remove:
      cmds:
        - docker compose down --rmi all
      silent: true

    build:
      cmds:
        - docker compose build
      silent: true

    start:
      cmds:
        - docker compose up -d
      silent: true

    stop:
      cmds:
        - docker compose stop
      silent: true

    status:
      cmds:
        - docker compose ps
      silent: true