-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
129 lines (107 loc) · 2.83 KB
/
Copy pathTaskfile.yml
File metadata and controls
129 lines (107 loc) · 2.83 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
version: "3"
vars:
ENV_FILE: '{{default ".env" .ENV_FILE}}'
IMAGE: '{{default "ghcr.io/bupd/shitpost" .IMAGE}}'
TAG: '{{default "dev" .TAG}}'
CROSSPOST_REPO: '{{default "https://github.com/bupd/crosspost.git" .CROSSPOST_REPO}}'
CROSSPOST_REF: '{{default "main" .CROSSPOST_REF}}'
tasks:
default:
desc: List available tasks
cmds:
- task --list
setup:
desc: Create .env from .env.example if missing and download Go deps
cmds:
- cmd: cp .env.example {{.ENV_FILE}}
status:
- test -f {{.ENV_FILE}}
- go mod download
up:
desc: Run the Telegram crosspost bot in Docker Compose
cmds:
- mkdir -p downloads
- docker compose up --build
up:dry-run:
desc: Run the Telegram crosspost bot in Docker Compose without posting
cmds:
- mkdir -p downloads
- SHITPOST_DRY_RUN=1 docker compose up --build
up:dry-run:detached:
desc: Run the Telegram crosspost bot in Docker Compose detached dry-run mode
cmds:
- mkdir -p downloads
- SHITPOST_DRY_RUN=1 docker compose up --build -d
up:detached:
desc: Run the Telegram crosspost bot in Docker Compose detached mode
cmds:
- mkdir -p downloads
- docker compose up --build -d
down:
desc: Stop the Docker Compose bot
cmds:
- docker compose down
logs:
desc: Follow Docker Compose bot logs
cmds:
- docker compose logs -f shitpost-bot
doctor:
desc: Check .env configuration without printing secret values
cmds:
- sh scripts/doctor.sh {{.ENV_FILE}}
dev:
desc: Run the Telegram crosspost bot locally without Docker
dotenv: ["{{.ENV_FILE}}"]
cmds:
- go run ./main.go
dev:dry-run:
desc: Run the Telegram crosspost bot locally without posting
dotenv: ["{{.ENV_FILE}}"]
cmds:
- SHITPOST_DRY_RUN=1 go run ./main.go
build:
desc: Build the bot binary
cmds:
- go build -o bot ./main.go
test:
desc: Run Go tests
cmds:
- go test ./...
lint:
desc: Run Go vet
cmds:
- go vet ./...
fmt:
desc: Format Go code
cmds:
- gofmt -w main.go
fmt:check:
desc: Check Go formatting
cmds:
- test -z "$(gofmt -l .)"
ci:
desc: Run CI checks without modifying files
cmds:
- task: fmt:check
- task: lint
- task: test
- task: build
validate:
desc: Format, lint, test, and build
cmds:
- task: fmt
- task: lint
- task: test
- task: build
image:build:
desc: Build the container image
cmds:
- docker build --build-arg CROSSPOST_REPO={{.CROSSPOST_REPO}} --build-arg CROSSPOST_REF={{.CROSSPOST_REF}} -t {{.IMAGE}}:{{.TAG}} .
compose:up:
desc: Run the bot in Docker Compose
cmds:
- task: up
compose:down:
desc: Stop the Docker Compose bot
cmds:
- task: down