-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
93 lines (86 loc) · 2.69 KB
/
Taskfile.yaml
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
---
version: "3"
vars:
PROJECT_NAME:
sh: pwd | grep -o "[^/]*$"
DATE:
sh: date +"%y.%m%d.%H%M"
BRANCH:
sh: if [ $(git rev-parse --abbrev-ref HEAD) != "main" ]; then echo $(git rev-parse --abbrev-ref HEAD); else echo main ; fi
tasks:
release:
deps:
- test
desc: push new version
cmds:
- task: pr
- npx semantic-release --dry-run
- npx semantic-release --debug --no-ci
- echo released version $(git describe --tags --abbrev=0)
pr:
desc: Create pull request into main
deps: [lint, test]
cmds:
- task: commit
- gh pr create -t "{{ .BRANCH }}" -b "{{ .BRANCH }} branch into main"
- sleep 20s
#- gh pr checks $(gh pr list | grep "^[^#;]" | grep '{{ .BRANCH }}' | awk '{print $1}') --watch
- gh pr merge $(gh pr list | grep "^[^#;]" | grep '{{ .BRANCH }}' | awk '{print $1}') --auto --rebase --delete-branch
- git checkout main && git pull
branch:
desc: Create branch from main
cmds:
- git checkout main
- git branch
- git pull
- |
echo "Enter to be created (remote) branch:"
read BRANCH_NAME;
git checkout -b ${BRANCH_NAME}
git push origin ${BRANCH_NAME}
- git branch
- git branch --set-upstream-to=origin/main ${BRANCH_NAME}
commit:
desc: Commit + push code into branch
cmds:
- rm -rf dist/
- git branch --set-upstream-to=origin/{{ .BRANCH }}
- git pull
- |
git add *
if [[ -n $(git status --porcelain) ]]; then
echo "ENTER COMMIT MESSAGE"
read COMMIT_MESSAGE;
echo "COMMITTING CHANGES"
git commit --allow-empty -a -m "$(echo ${COMMIT_MESSAGE})"
else
echo "NO CHANGES"
fi
git push origin -u {{ .BRANCH }}
lint:
desc: Lint code
cmds:
- go mod tidy
- cmd: golangci-lint run
ignore_error: true
test:
desc: Test code
cmds:
- go mod tidy
- cmd: go test -v
tag:
desc: commit, push & tag the module
deps: [lint, test]
cmds:
- go mod tidy
- git pull
- git add *
- git commit -am 'updated {{ .PROJECT_NAME }} {{ .DATE }} for tag version {{ .UPDATED_TAG_VERSION }}'
- git push
- git tag -a {{ .UPDATED_TAG_VERSION }} -m 'updated for stuttgart-things {{.DATE}} for tag version {{ .UPDATED_TAG_VERSION }}'
- git push origin --tags
vars:
UPDATED_TAG:
sh: old_tag=$(git describe --tags --abbrev=0 | cut -d "." -f3); new_tag=$((old_tag+1)); echo $new_tag
UPDATED_TAG_VERSION:
sh: t1=$(git describe --tags --abbrev=0 | cut -f1 -d'.'); t2=$(git describe --tags --abbrev=0 | cut -f2 -d'.'); echo $t1.$t2.{{.UPDATED_TAG}}