-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
63 lines (54 loc) · 2.09 KB
/
Taskfile.yml
File metadata and controls
63 lines (54 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
version: '3'
dotenv: [".task.env", ".env"]
vars:
DOCKER_COMPOSE: '{{ .TASK_DOCKER_COMPOSE | default "docker compose" }}'
# https://taskfile.dev/reference/templating/
BASE_URL: '{{.TASK_BASE_URL | default .COMPOSE_SERVER_DOMAIN | default .COMPOSE_DOMAIN | default ""}}'
tasks:
compose:
desc: "Run `docker compose` command. Example: task compose -- up --detach"
cmds:
- '{{ .DOCKER_COMPOSE }} {{ .CLI_ARGS }}'
compose-exec:
desc: "Run `docker compose exec` command handling content on stdin. Example: task compose-exec -- phpfpm php -v"
cmds:
# Check if we have content on stdin (cf.
# https://unix.stackexchange.com/questions/762992/bash-check-if-the-standard-input-contains-anything)
- if [[ ! -t 0 ]]; then task compose -- exec --no-TTY {{ .CLI_ARGS }}; else task compose -- exec {{ .CLI_ARGS }}; fi
silent: true
composer:
desc: "Run composer command. Example: task composer -- install"
cmds:
- task compose-exec -- phpfpm composer {{ .CLI_ARGS }}
silent: true
drush:
desc: "Run Drush command. Example: task drush -- user:login"
cmds:
# Notice: To make debugging (with Xdebug) work, we have to call
# vendor/bin/drush.php directly (and not vendor/bin/drush)
- task compose-exec -- phpfpm vendor/bin/drush --uri={{.URI}} {{ .CLI_ARGS }}
vars:
URI:
sh: task site-url
silent: true
set-user-roles:
desc: "Set some user's roles"
cmds:
- task drush -- user:role:add 'administrator' admin
silent: true
export-default-conf:
desc: "Build site using existing config and exports it. Beware! This will reset your local database."
cmds:
- task compose -- up --detach
- task composer -- install
- task drush -- site-install --existing-config --yes
- task drush -- config:export --yes
site-url:
desc: "Show site URL"
cmds:
- echo {{.URL}}
vars:
URL:
# Compute base URL if not set.
sh: if [ ! -z "{{.BASE_URL}}" ]; then echo "https://{{.BASE_URL}}"; else echo "http://$(task compose -- port nginx 8080)"; fi
silent: true