-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
79 lines (72 loc) · 2.65 KB
/
Copy pathTaskfile.yml
File metadata and controls
79 lines (72 loc) · 2.65 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
# Taskfile for sprisa/opencode Docker image.
# Install go-task: https://taskfile.dev/installation/ (brew install go-task)
# Run `task` (or `task --list`) to see available commands.
version: "3"
vars:
REGISTRY: docker.io
OWNER: sprisa
IMAGE: opencode
RELEASE_REPO: "{{.OWNER}}/opencode-docker"
OCI: "{{.REGISTRY}}/{{.OWNER}}/{{.IMAGE}}"
VERSION:
sh: cat version.txt | tr -d '[:space:]'
tasks:
default:
desc: List available tasks
cmds:
- task --list
silent: true
update:
desc: Fetch latest opencode release version from GitHub and update version.txt
preconditions:
- sh: command -v curl >/dev/null
msg: "curl not found"
- sh: command -v jq >/dev/null
msg: "jq not found. Install it: brew install jq"
cmds:
- |
LATEST=$(curl -fsSL https://api.github.com/repos/anomalyco/opencode/releases/latest \
| jq -r '.tag_name' | sed 's/^v//')
CURRENT=$(cat version.txt | tr -d '[:space:]')
if [ "$LATEST" != "$CURRENT" ]; then
echo "$LATEST" > version.txt
echo "Updated: $CURRENT -> $LATEST"
else
echo "Already at latest: $CURRENT"
fi
docker:build:
desc: "Build the image locally (tag: sprisa/opencode:<version>)"
cmds:
- "docker build --build-arg OPENCODE_VERSION={{.VERSION}} -t {{.OCI}}:{{.VERSION}} ."
docker:push:
desc: "Build and push multi-arch to Docker Hub with <version> and :latest tags"
cmds:
- |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--build-arg OPENCODE_VERSION={{.VERSION}} \
--push \
-t {{.OCI}}:{{.VERSION}} \
-t {{.OCI}}:latest \
.
- "echo Pushed {{.OCI}}:{{.VERSION}} and {{.OCI}}:latest"
docker:login:
desc: "Log in to Docker Hub (needs $DOCKER_USER and $DOCKER_PASS)"
preconditions:
- sh: '[ -n "$DOCKER_USER" ]'
msg: "Set DOCKER_USER"
- sh: '[ -n "$DOCKER_PASS" ]'
msg: "Set DOCKER_PASS (use a Docker Hub access token)"
cmds:
- "echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin"
publish:
desc: "Push the image and create a GitHub Release (run docker:login first)"
deps: [docker:push]
preconditions:
- sh: command -v gh >/dev/null
msg: "GitHub CLI not found. Install it: brew install gh"
- sh: gh auth status >/dev/null 2>&1
msg: "Not logged in to GitHub CLI. Run: gh auth login"
cmds:
- ./scripts/release-notes.sh v{{.VERSION}} {{.RELEASE_REPO}} > ./RELEASE_NOTES.md
- gh release create v{{.VERSION}} --repo {{.RELEASE_REPO}} --title "v{{.VERSION}}" --notes-file ./RELEASE_NOTES.md