File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,47 @@ $ git-semver compare 1.2.3 1.2.3+build-2018-12-31
163
163
=
164
164
```
165
165
166
+ ## Example GitLab Job Template
167
+
168
+ ``` yaml
169
+ stages :
170
+ - tag
171
+
172
+ tag :
173
+ image :
174
+ name : psanetra/git-semver:latest
175
+ entrypoint :
176
+ - " /usr/bin/env"
177
+ - " PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
178
+ stage : tag
179
+ variables :
180
+ GIT_DEPTH : 0
181
+ GIT_FETCH_EXTRA_FLAGS : " --prune --prune-tags --tags"
182
+ before_script :
183
+ - apk add --upgrade --no-cache curl
184
+ script : |
185
+ set -ex
186
+ LATEST_VERSION="$(git semver latest)"
187
+ NEXT_VERSION="$(git semver next)"
188
+ if [ "${LATEST_VERSION}" != "${NEXT_VERSION}" ]; then
189
+ NEXT_TAG="v${NEXT_VERSION}"
190
+ git tag "${NEXT_TAG}"
191
+ CHANGELOG="$(git semver log --markdown ${NEXT_TAG})"
192
+ curl -X POST \
193
+ --header "JOB-TOKEN: ${CI_JOB_TOKEN}" \
194
+ --form "tag_name=v${NEXT_VERSION}" \
195
+ --form "ref=${CI_COMMIT_SHA}" \
196
+ --form "description=${CHANGELOG}" \
197
+ "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/releases"
198
+ fi
199
+ only :
200
+ - main
201
+ - master
202
+ except :
203
+ - tags
204
+ - schedules
205
+ ` ` `
206
+
166
207
## License
167
208
168
209
MIT
You can’t perform that action at this time.
0 commit comments