-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
29 lines (28 loc) · 909 Bytes
/
Taskfile.yml
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
version: '3'
tasks:
git-push:
desc: Push changes to git | Example- task git-push TAG_NAME=v1.0.0 TAG_MESSAGE="Release v1.0.0"
vars:
TAG_NAME: "{{.TAG_NAME}}"
TAG_MESSAGE: "{{.TAG_MESSAGE}}"
cmds:
- |
if [ -z "$(git rev-parse --verify HEAD 2>/dev/null)" ]; then
echo "No commits found. Creating initial commit."
git add .
git commit -m "Initial commit"
fi
- |
if git rev-parse "{{.TAG_NAME}}" >/dev/null 2>&1; then
echo "Tag '{{.TAG_NAME}}' already exists. Skipping tag creation."
else
git tag -a "{{.TAG_NAME}}" -m "{{.TAG_MESSAGE}}"
fi
- |
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "{{.TAG_MESSAGE}}"
git push origin main --tags
else
echo "Nothing to commit, working tree clean."
fi