Repository navigation
Expand file tree
/
Copy pathTaskfile.yml
More file actions
88 lines (80 loc) · 3.17 KB
/
Copy pathTaskfile.yml
File metadata and controls
88 lines (80 loc) · 3.17 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
# https://taskfile.dev
version: '3'
tasks:
default:
desc: "build binary"
cmds:
- go build -o ./where-to ./main.go
- echo 'run `eval "$(./where-to)"` in your terminal to complete setup'
silent: true
install:
desc: "installs binary from source using golang"
cmds:
- GOPROXY=direct go install github.com/nanvenomous/where-to@latest
tape:
desc: "run integration tapes"
cmds:
- VHS_NO_SANDBOX=true vhs tapes/dn.tape
- VHS_NO_SANDBOX=true vhs tapes/t.tape
- VHS_NO_SANDBOX=true vhs tapes/to.tape
- VHS_NO_SANDBOX=true vhs tapes/up.tape
# - firefox tapes
release:
desc: "<1.2.3> bump version and create GitHub release for all platforms"
vars:
VERSION: '{{.CLI_ARGS}}'
preconditions:
- sh: test -n "{{.VERSION}}"
msg: "Version is required. Usage: task release -- 1.0.8"
- sh: echo "{{.VERSION}}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$'
msg: "Version must be in semver format (e.g., 1.0.8)"
cmds:
# Update version file
- echo "{{.VERSION}}" > version
- echo "Updating version to {{.VERSION}}..."
# Test build to make sure everything works
- echo "Testing build..."
- go build -o where-to-test
- |
VERSION_OUTPUT=$(./where-to-test version)
if [[ $VERSION_OUTPUT == *"{{.VERSION}}"* ]]; then
echo "✓ Version update successful: $VERSION_OUTPUT"
else
echo "✗ Version update failed. Expected {{.VERSION}}, got: $VERSION_OUTPUT"
exit 1
fi
- rm -f where-to-test
# Stage and commit version change
- git add version
- git commit -m "bump version to v{{.VERSION}}"
- echo "✓ Version committed"
# Build cross-platform binaries
- mkdir -p dist
- rm -rf dist/*
- echo "Building cross-platform binaries..."
# Build for Linux amd64
- GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dist/where-to-linux-amd64 ./main.go
# Build for macOS amd64
- GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o dist/where-to-darwin-amd64 ./main.go
# Build for macOS arm64 (Apple Silicon)
- GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o dist/where-to-darwin-arm64 ./main.go
# Build for Windows amd64
- GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o dist/where-to-windows-amd64.exe ./main.go
# Create universal binary for the readme curl command (Linux amd64 as default)
- echo "✓ Cross-platform binaries built"
# Create git tag and push
- git tag -a v{{.VERSION}} -m "Release v{{.VERSION}}"
- git push origin HEAD
- git push origin v{{.VERSION}}
- echo "✓ Git tag v{{.VERSION}} created and pushed"
# Create GitHub release
- |
gh release create v{{.VERSION}} \
--title "Release v{{.VERSION}}" \
--notes "Release v{{.VERSION}}" \
dist/where-to-linux-amd64 \
dist/where-to-darwin-amd64 \
dist/where-to-darwin-arm64 \
dist/where-to-windows-amd64.exe
- echo "✓ GitHub release v{{.VERSION}} created with all binaries"
- echo "✓ Release complete!"