-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
116 lines (114 loc) · 3.92 KB
/
Taskfile.yaml
File metadata and controls
116 lines (114 loc) · 3.92 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
version: '3'
tasks:
post-setup:
desc: Post configuration
silent: true
cmds:
- task: configure
- task: install-tools
- pre-commit install
install-tools:
desc: Install necessary tools for development
silent: true
cmds:
- task: asdf
- task: helm-plugins
- task: npm-packages
- task: wget
helm-plugins:
desc: Install helm plugins
vars:
HELM_PLUGIN:
- https://github.com/databus23/helm-diff
- https://github.com/jkroepke/helm-secrets
- https://github.com/vmware-labs/distribution-tooling-for-helm
cmds:
- echo "📦 Installing Helm plugins..."
- for: { var: HELM_PLUGIN }
cmd: helm plugin install {{.ITEM}} --verify=false
npm-packages:
desc: Install npm packages
silent: true
vars:
NPM_PACKAGE:
- better-commits
cmds:
- echo "📦 Installing npm packages..."
- for: { var: NPM_PACKAGE }
cmd: npm install -g {{.ITEM}}
asdf:
desc: Install tools using asdf from .tool-versions
silent: true
cmds:
- echo "⬇️ Adding custom asdf plugins..."
- asdf plugin add opencode https://github.com/bitfrost/asdf-opencode.git
- ASDF_PYAPP_INCLUDE_DEPS=1 asdf plugin add ansible https://github.com/amrox/asdf-pyapp.git
- command -v asdf >/dev/null || { echo "❌ asdf not found"; exit 1; }
- '[ -f .tool-versions ] || { echo "❌ .tool-versions not found"; exit 1; }'
- |
while IFS= read -r line; do
[ -z "$line" ] && continue # skip empty lines
name=$(echo "$line" | awk '{print $1}')
version=$(echo "$line" | awk '{print $2}')
echo "📦 Installing $name $version..."
asdf plugin add "$name" || echo "Plugin $name already added or failed to add."
asdf install "$name" "$version"
done < .tool-versions
- echo "✅ All tools from .tool-versions installed via asdf"
wget:
desc: Install tools via wget
silent: true
vars:
TOOLS:
- name: yj
url: https://github.com/sclevine/yj/releases/download/v5.1.0/yj-linux-amd64
- name: yq
url: https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
cmds:
- echo "📦 Installing tools via wget..."
- for: { var: TOOLS }
cmd: |
echo "Downloading {{.ITEM.name}} from {{.ITEM.url}}..."
sudo wget -qO /usr/local/bin/{{.ITEM.name}} {{.ITEM.url}}
sudo chmod +x /usr/local/bin/{{.ITEM.name}}
echo "✅ {{.ITEM.name}} installed successfully"
check-branch:
desc: Checking branch name format
silent: true
vars:
REGEX: "^(feat|fix|docs|refactor|perf|test|build|ci|chore)\\/[A-Za-z0-9._-]+$"
cmds:
- |
if [[ -z "${BRANCH}" ]]; then
BRANCH=$(git rev-parse --abbrev-ref HEAD)
else
BRANCH="${BRANCH}"
fi
echo "Branch name: $BRANCH"
if ! [[ $BRANCH =~ {{ .REGEX }} ]]; then
echo "Your commit was rejected due to branching name"
echo "Please rename your branch with '(feat|fix|docs|refactor|perf|test|build|ci|chore)/lowercase-name' syntax"
echo "Or you can use better-branch tools"
exit 1
fi
configure:
desc: Check and configure
silent: true
cmds:
- |
if ! grep -q 'starship init bash' ~/.bashrc 2>/dev/null; then
echo 'eval "$(starship init bash)"' >> ~/.bashrc
echo "✅ Added starship init to ~/.bashrc"
else
echo "✅ Starship init already present in ~/.bashrc"
fi
- |
if ! grep -q '\.bash_aliases' ~/.bashrc 2>/dev/null; then
echo '[ -f ~/.bash_aliases ] && source ~/.bash_aliases' >> ~/.bashrc
echo "✅ Added .bash_aliases sourcing to ~/.bashrc"
else
echo "✅ .bash_aliases already sourced in ~/.bashrc"
fi
- |
mkdir -p ~/.config/gcloud
stow -t ~/ dotfiles