-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yml
211 lines (187 loc) · 6.14 KB
/
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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
version: 3
env:
REPOSITORY: sfcc-cartridge
# This project requires node 12.x.
# You can set RUN_IN_DOCKER env var to true to run the tasks if you don't have node 12.x installed.
RUN_IN_DOCKER: '{{ .RUN_IN_DOCKER | default "false" }}'
tasks:
default:
silent: true
cmds:
- task -l
brew:
preconditions:
- sh: brew -v
msg: 'This task requires `brew`. Please refer to this documentation: https://brew.sh/'
pre-commit:
desc: Install pre-commit tool
internal: true
deps: [brew]
status:
- pre-commit --version
cmds:
- brew install pre-commit
pre-commit:install:
desc: Install and set up pre-commit hooks
deps: [pre-commit]
cmds:
- pre-commit install --hook-type pre-commit --hook-type commit-msg
docker:build:
desc: Build sfcc-cartridge docker image
cmds:
- docker compose build sfcc-cartridge
upload:
desc: Upload changes on a test env of SFCC
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build --rm sfcc-cartridge npx sgmf-scripts --uploadCartridge int_alma
{{else}}
npx sgmf-scripts --uploadCartridge int_alma
{{end}}
build:
desc: Build metadata .zip file (based on .env file)
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build --rm sfcc-cartridge node site_preference_builder/compress.js && node site_preference_builder/main.js
{{else}}
node site_preference_builder/compress.js && node site_preference_builder/main.js
{{end}}
test:
desc: Execute Unit Tests with coverage
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build -T --rm sfcc-cartridge npx sgmf-scripts --cover test/unit/**/*.js
{{else}}
npx sgmf-scripts --cover test/unit/**/*.js
{{end}}
lint:
desc: Run linter
deps:
- js:lint
- css:lint
js:lint:
desc: Run JS linter
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build -T --rm sfcc-cartridge npx sgmf-scripts --lint js
{{else}}
npx sgmf-scripts --lint js
{{end}}
css:lint:
desc: Run CSS linter
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build -T --rm sfcc-cartridge npx sgmf-scripts --lint css
{{else}}
npx sgmf-scripts --lint css
{{end}}
isml:lint:
desc: Run ISML linter
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build -T --rm sfcc-cartridge npx isml-linter --build
{{else}}
npx isml-linter --build
{{end}}
lint:fix:
desc: Run linter and apply fix
deps:
- js:lint:fix
- css:lint:fix
js:lint:fix:
desc: Run JS linter and apply fix
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build -T --rm sfcc-cartridge npx sgmf-scripts --lint js --fix
{{else}}
npx sgmf-scripts --lint js --fix
{{end}}
css:lint:fix:
desc: Run CSS linter and apply fix
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build -T --rm sfcc-cartridge npx sgmf-scripts --lint css --fix
{{else}}
npx sgmf-scripts --lint css --fix
{{end}}
isml:lint:fix:
desc: Run ISML linter and apply fix
cmds:
- |
{{if eq .RUN_IN_DOCKER "true"}}
docker compose run --build -T --rm sfcc-cartridge npx isml-linter --autofix
{{else}}
npx isml-linter --autofix
{{end}}
crowdin:
internal: true
preconditions:
- sh: which crowdin
msg: Crowdin CLI is required
crowdin:download:
desc: Download translations from Crowdin
deps:
- crowdin
cmds:
- crowdin download
crowdin:upload:
desc: Upload translations to Crowdin
deps:
- crowdin
cmds:
- crowdin upload sources
gh-cli:
internal: true
preconditions:
- sh: gh --version
msg: |
⚠️ This task requires `gh` (Github CLI).
Please check out: https://github.com/cli/cli#installation
You'll need a personal access token to authenticate with `gh`.
Please check out: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token#creating-a-personal-access-token-classic
Then, run `gh auth login` or set the GITHUB_TOKEN environment variable with your personal access token.
release:
deps:
- gh-cli
desc: Create a release pull request
cmds:
- gh workflow run release-pull-request.yml
- cmd: sleep 2
silent: true
- cmd: echo "Release pull request created, check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Arelease"
silent: true
- cmd: echo "If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/release-pull-request.yml"
silent: true
- cmd: echo "Please, review and merge the pull request."
silent: true
- cmd: echo "After merging, the release will be automatically created."
silent: true
hotfix:
deps:
- gh-cli
desc: Create a hotfix pull request
preconditions:
- sh: test -n "{{.CHANGELOG_MESSAGE}}"
msg: |
⚠️ This task requires a changelog message.
Please provide a changelog message. Example: `task hotfix CHANGELOG_MESSAGE='This is a message'`.
cmds:
- gh workflow run hotfix-pull-request.yml -F changelog-message='{{.CHANGELOG_MESSAGE}}'
- cmd: sleep 2
silent: true
- cmd: echo "Hotfix pull request created, check out https://github.com/alma/{{.REPOSITORY}}/pulls?q=is%3Aopen+is%3Apr+label%3Ahotfix"
silent: true
- cmd: echo "If no pull request is created, check out https://github.com/alma/{{.REPOSITORY}}/actions/workflows/hotfix-pull-request.yml"
silent: true
- cmd: echo "Please, review and merge the pull request."
silent: true
- cmd: echo "After merging, the release will be automatically created."
silent: true