This repository contains reusable Taskfile templates to standardize and simplify common tasks like running pre-commit hooks, generating changelogs, creating GitHub releases, and more.
To use the Taskfile templates in your project, include the remote Taskfiles in
your project's Taskfile.yaml
:
version: "3"
includes:
pre-commit:
taskfile: "https://raw.githubusercontent.com/CowDogMoo/taskfile-templates/main/pre-commit/Taskfile.yaml"
github:
taskfile: "https://raw.githubusercontent.com/CowDogMoo/taskfile-templates/main/github/Taskfile.yaml"
tasks:
default:
cmds:
- task: pre-commit:update-hooks
- task: github:create-release
This setup automatically pulls in both the pre-commit
and github
tasks from
the remote repository.
Enable remote Taskfiles by setting this environment variable:
export TASK_X_REMOTE_TASKFILES=1
For more details, refer to the Taskfile documentation.
Once you've included the Taskfiles in your project, you can use the tasks like so:
task pre-commit:update-hooks
task pre-commit:clear-cache
task pre-commit:run-hooks
task github:create-release
Many of the templates support configuration through environment variables. When you export an environment variable in your shell, Task will automatically pick it up:
# Set environment variable
export GITHUB_TOKEN=your-token-here
# Task will use this value automatically
task github:create-release
Task follows this precedence order (highest to lowest priority):
- CLI variables:
task github:create-release NEXT_VERSION=1.0.0
- Task-level variables: Variables defined in the task itself
- Global variables: Variables in the
vars:
section of your Taskfile - Environment variables: Variables from your shell environment
This means you can override any default configuration by passing variables directly:
# Override with CLI variable (highest priority)
task github:create-release NEXT_VERSION=2.0.0
# Or set via environment (lower priority)
export NEXT_VERSION=2.0.0
task github:create-release
If your Taskfile uses template syntax like this:
vars:
MY_VAR: '{{.MY_VAR | default (env "MY_VAR") | default "fallback"}}'
It will check in order:
- Task variable
.MY_VAR
- Environment variable
MY_VAR
- Default value
"fallback"
This allows maximum flexibility in how you configure the templates.
Each taskfile template includes its own README with detailed documentation about available tasks and configuration options. Here are the available templates:
- ansible/ - Ansible automation tasks including playbook execution, inventory management, and role testing
- aws/ - AWS CLI operations, resource management, and deployment tasks
- docker/ - Docker container and image management, compose operations, and registry tasks
- github/ - GitHub repository management, release creation, PR automation, and submodule handling
- k8s/ - Kubernetes deployment, service management, and cluster operations
- packer/ - Packer image building, validation, and artifact management
- pre-commit/ - Pre-commit hook management, updates, and execution
- renovate/ - Renovate dependency update automation and configuration
- secrets/ - Secret management with support for:
- local/ - Local secret storage and retrieval
- onepassword/ - 1Password integration for team secret management
- terraform/ - Terraform/Terragrunt operations including apply, destroy, validation, and testing
- unifi/ - UniFi network controller management and configuration tasks
To see available tasks for any template, check the README in the respective directory. For example:
- View Docker tasks: docker/README.md
- View GitHub tasks: github/README.md
- View Terraform tasks: terraform/README.md
Each README includes:
- Complete list of available tasks
- Required and optional variables
- Usage examples
- Configuration options
Have an idea for a useful task? Submit a pull request! Ensure your Taskfiles are well-documented and follow the structure of existing files.
This project is licensed under the MIT License. See the LICENSE file for details.