35 Commits

Author SHA1 Message Date
35625f66bf feat(changelog): display message in changelog when no commit is selected in release
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-25 08:17:20 -06:00
367dbf1883 docs: add changelog link in readme
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-25 08:12:33 -06:00
1eeb6043ba chore: update changelog template
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-25 08:11:23 -06:00
4d31268d7e chore: update changelog
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-25 08:09:39 -06:00
be97e7760f chore: update changelog
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-25 08:06:44 -06:00
4b3d1c37b8 docs: describe project-version tasks 2023-08-25 08:06:24 -06:00
5ace960da2 feat(changelog): allow override of command arguments
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-24 14:47:55 -06:00
5abe33e487 fix(version): normalize variable names
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-24 12:41:11 -06:00
1de7156649 feat(version): permit branch name overwrite
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-24 11:17:41 -06:00
fa2dab537e chore: update changelog
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-24 10:27:52 -06:00
19785045b6 feat(changelog): skip unreleased section if no commits are associated
Some checks reported errors
Cadoles/mktools/pipeline/head Something is wrong with the build of this commit
2023-08-24 10:27:38 -06:00
5a0e3edc8e feat(version): use commit timestamp to generate project version
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-24 07:58:54 -06:00
3308856636 fix(install): add missing tasks in install script
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-23 16:26:40 -06:00
1b5c364977 chore: update changelog
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-23 16:15:43 -06:00
0545812d87 docs: add tutorial to generate release with its changelog 2023-08-23 16:15:31 -06:00
806327e1e5 chore: update changelog
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-23 16:08:41 -06:00
9730ec914b chore: reuse variables 2023-08-23 16:04:19 -06:00
e4f2359324 style: lint makefile
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
2023-08-23 15:56:04 -06:00
ab89789e3e ci: disable build and release stages
Some checks reported warnings
Cadoles/mktools/pipeline/head This commit is unstable
2023-08-23 15:53:40 -06:00
643e170d49 chore: update changelog
Some checks failed
Cadoles/mktools/pipeline/head There was a failure building this commit
2023-08-23 15:45:39 -06:00
2f77f3e72e chore: update changelog
Some checks failed
Cadoles/mktools/pipeline/head There was a failure building this commit
2023-08-23 15:40:52 -06:00
92c3a7e6a5 chore: prune local tags before generating changelog 2023-08-23 15:40:36 -06:00
56d4a9f77e chore: update changelog
Some checks failed
Cadoles/mktools/pipeline/head There was a failure building this commit
2023-08-23 15:33:44 -06:00
bec93c7a9d chore: use tag as release target 2023-08-23 15:33:35 -06:00
8b361ede1d chore: update changelog 2023-08-23 15:30:40 -06:00
f7e31f8f41 chore: tag current commit in release task
Some checks failed
Cadoles/mktools/pipeline/head There was a failure building this commit
2023-08-23 15:27:01 -06:00
18e03f54de chore: update changelog 2023-08-23 15:23:47 -06:00
7165d90d2d feat(version): use master and staging branches as aliases for testing and stable
Some checks failed
Cadoles/mktools/pipeline/head There was a failure building this commit
2023-08-23 15:18:58 -06:00
03081e4549 Merge pull request 'ci: add jenkins pipeline' (#1) from ci-pipeline into master
All checks were successful
Cadoles/mktools/pipeline/head This commit looks good
Reviewed-on: #1
2023-08-23 22:57:21 +02:00
48bcb9c57e chore: update changelog
All checks were successful
Cadoles/mktools/pipeline/pr-master This commit looks good
2023-08-23 14:53:02 -06:00
01fc3bb0be feat: add changelog 2023-08-23 14:53:02 -06:00
3a76185c3c ci: add jenkins pipeline 2023-08-23 14:53:02 -06:00
d28cc3a672 fix(changelog): add missing task dependency 2023-08-23 12:06:20 -06:00
140ce517cf feat(gitea-release): automatically add tools directory to git ignored files 2023-08-23 11:42:53 -06:00
e2f267757a feat: add mkt-changelog task 2023-08-23 11:40:20 -06:00
15 changed files with 427 additions and 4 deletions

44
.chglog/CHANGELOG.tpl.md Normal file
View File

@ -0,0 +1,44 @@
{{ if .Versions -}}
{{ if .Unreleased.CommitGroups -}}
<a name="unreleased"></a>
## [Unreleased]
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ else }}
_Nothing functionally significant._
{{ end -}}
{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}

33
.chglog/config.yml Normal file
View File

@ -0,0 +1,33 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://forge.cadoles.com/Cadoles/mktools
options:
commits:
filters:
Type:
- feat
- fix
- perf
- refactor
- docs
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
docs: Documentation
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
issues:
prefix:
- '#'

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
tools/

60
CHANGELOG.md Normal file
View File

@ -0,0 +1,60 @@
<a name="unreleased"></a>
## [Unreleased]
<a name="2023.8.25-stable.1606.be97e77"></a>
## [2023.8.25-stable.1606.be97e77] - 2023-08-25
### Bug Fixes
- **version:** normalize variable names
### Documentation
- describe project-version tasks
### Features
- **changelog:** allow override of command arguments
- **version:** permit branch name overwrite
<a name="2023.8.24-stable.1827.fa2dab5"></a>
## [2023.8.24-stable.1827.fa2dab5] - 2023-08-24
<a name="2023.8.24-stable.1827.1978504"></a>
## [2023.8.24-stable.1827.1978504] - 2023-08-24
### Bug Fixes
- **install:** add missing tasks in install script
### Features
- **changelog:** skip unreleased section if no commits are associated
- **version:** use commit timestamp to generate project version
<a name="2023.8.23-stable.1615.1b5c364"></a>
## [2023.8.23-stable.1615.1b5c364] - 2023-08-23
<a name="2023.8.23-stable.1615.0545812"></a>
## [2023.8.23-stable.1615.0545812] - 2023-08-23
### Bug Fixes
- **changelog:** add missing task dependency
### Documentation
- add tutorial to generate release with its changelog
### Features
- add changelog
- add mkt-changelog task
- **gitea-release:** automatically add tools directory to git ignored files
- **version:** use master and staging branches as aliases for testing and stable
<a name="2023.8.23-stable.1207.cd2f1ba"></a>
## 2023.8.23-stable.1207.cd2f1ba - 2023-08-21
### Features
- initial commit
[Unreleased]: https://forge.cadoles.com/Cadoles/mktools/compare/2023.8.25-stable.1606.be97e77...HEAD
[2023.8.25-stable.1606.be97e77]: https://forge.cadoles.com/Cadoles/mktools/compare/2023.8.24-stable.1827.fa2dab5...2023.8.25-stable.1606.be97e77
[2023.8.24-stable.1827.fa2dab5]: https://forge.cadoles.com/Cadoles/mktools/compare/2023.8.24-stable.1827.1978504...2023.8.24-stable.1827.fa2dab5
[2023.8.24-stable.1827.1978504]: https://forge.cadoles.com/Cadoles/mktools/compare/2023.8.23-stable.1615.1b5c364...2023.8.24-stable.1827.1978504
[2023.8.23-stable.1615.1b5c364]: https://forge.cadoles.com/Cadoles/mktools/compare/2023.8.23-stable.1615.0545812...2023.8.23-stable.1615.1b5c364
[2023.8.23-stable.1615.0545812]: https://forge.cadoles.com/Cadoles/mktools/compare/2023.8.23-stable.1207.cd2f1ba...2023.8.23-stable.1615.0545812

6
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,6 @@
@Library("cadoles") _
standardMakePipeline([
'buildTask': null,
'releaseTask': null
])

38
Makefile Normal file
View File

@ -0,0 +1,38 @@
.PHONY: all
all: test build
.PHONY: test
test: tools/checkmake/bin/checkmake
tools/checkmake/bin/checkmake Makefile
MKT_GITEA_RELEASE_ORG ?= Cadoles
MKT_GITEA_RELEASE_PROJECT ?= mktools
.PHONY: release
release:
git tag $(MKT_PROJECT_VERSION) && git push --tags
$(MAKE) update-changelog
$(MAKE) MKT_GITEA_RELEASE_ATTACHMENTS="$(MKT_GITEA_RELEASE_ATTACHMENTS) CHANGELOG.md" \
MKT_GITEA_RELEASE_COMMIT_TARGET="$(MKT_PROJECT_VERSION)" \
mkt-gitea-release
.PHONY: clean
clean:
rm -rf tools
.PHONY: update-changelog
update-changelog:
$(MAKE) changelog
git add CHANGELOG.md
git commit -m "chore: update changelog"
git push
.PHONY: changelog
changelog:
git fetch --prune-tags
$(MAKE) \
MKT_GIT_CHGLOG_PROJECT_ORG=$(MKT_GITEA_RELEASE_ORG) \
MKT_GIT_CHGLOG_PROJECT_NAME=$(MKT_GITEA_RELEASE_PROJECT) \
mkt-changelog
include tasks/*.mk

View File

@ -36,4 +36,14 @@ Tâches [Make](https://fr.wikipedia.org/wiki/Make) génériques à utiliser de p
|Tâches|Description|Documentation|
|------|-----------|-------------|
|`make mkt-webdav-upload`|Téléverser un fichier dans un répertoire WebDAV (Nextcloud)|[Voir ./doc/tasks/webdav.md](./doc/tasks/webdav.md)|
|`make mkt-gitea-release`|Créer une release sur un projet Gitea et téléverser des fichiers attachés|[Voir ./doc/tasks/gitea.md](./doc/tasks/gitea.md)|
|`make mkt-gitea-release`|Créer une release sur un projet Gitea et téléverser des fichiers attachés|[Voir ./doc/tasks/gitea.md](./doc/tasks/gitea.md)|
|`make mkt-changelog`|Générer un fichier de `CHANGELOG.md` pour votre projet|[Voir ./doc/tasks/changelog.md](./doc/tasks/changelog.md)|
|`make mkt-project-version`|Générer et afficher la version courante du projet|[Voir ./doc/tasks/changelog.md](./doc/tasks/project-version.md)|
## Tutoriels
- [Créer une "release" avec son fichier `CHANGELOG.md`](./doc/tutorials/generate-release-with-changelog.md)
# Changelog
[Voir le fichier `CHANGELOG.md`](./CHANGELOG.md)

26
doc/tasks/changelog.md Normal file
View File

@ -0,0 +1,26 @@
# Tâches Changelog
## `make mkt-changelog`
La tâche `mkt-changelog` permet de générer un fichier `CHANGELOG.md` avec l'outil [`git-chglog`](https://github.com/git-chglog/git-chglog) et de l'historique Git de votre projet.
L'usage de cette tâche a pour prérequis que vos messages de commit respectent la spécification ["Conventional Commit"](https://www.conventionalcommits.org/fr/v1.0.0/).
Par défaut voici [les types de commit](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type) référencés par le fichier généré:
- `feat`
- `fix`
- `perf`
- `refactor`
- `docs`
### Usage
Exemple d'utilisation de la tâche pour la génération du changelog du projet `https://forge.cadoles.com/MyOrg/MyProject` sur la forge:
```makefile
my-changelog:
$(MAKE) MKT_GIT_CHGLOG_PROJECT_ORG=MyOrg MKT_GIT_CHGLOG_PROJECT_NAME=MyProject mkt-changelog
```
> **Note** Assurez vous d'avoir créé un premier tag sur la branche en cours avant d'exécuter la tâche.

View File

@ -0,0 +1,13 @@
# Tâches "Project Version"
## Variables `MKT_PROJECT_VERSION` et `MKT_PROJECT_SHORT_VERSION`
Les variables `MKT_PROJECT_VERSION` et `MKT_PROJECT_SHORT_VERSION` sont automatiquement valuées à la version courante du projet tel que défini dans ["R14. Respecter le schéma d'identification des images publiées"](https://forge.cadoles.com/CadolesKube/KubeRules/wiki/Bonnes-pratiques-de-d%C3%A9veloppement-applicatif-en-vue-d%27un-d%C3%A9ploiement-sur-Kubernetes#r14-respecter-le-sch%C3%A9ma-d-identification-des-images-publi%C3%A9es).
## `make mkt-project-version`
La tâche `make mkt-project-version` affiche sur la sortie standard la version courante du projet.
## `make mkt-project-short-version`
La tâche `make mkt-project-short-version` affiche sur la sortie standard la version courte courante du projet.

View File

@ -0,0 +1,34 @@
# Générer une release pour son projet
Afin de générer une release pour votre projet (exemple: https://forge.cadoles.com/Cadoles/mktools/releases/tag/2023.8.23-stable.1545.643e170) ainsi que le fichier `CHANGELOG.md` associé à votre historique Git, vous pouvez intégrer à votre `Makefile` les tâches suivantes:
```makefile
MKT_GITEA_RELEASE_ORG ?= MyOrg # Propriétaire (organisation ou utilsateur) du projet Gitea
MKT_GITEA_RELEASE_PROJECT ?= MyProject # Nom du projet Gitea
.PHONY: release
release:
git tag $(MKT_PROJECT_VERSION) && git push --tags
$(MAKE) update-changelog
$(MAKE) MKT_GITEA_RELEASE_ATTACHMENTS="$(MKT_GITEA_RELEASE_ATTACHMENTS) CHANGELOG.md" \
MKT_GITEA_RELEASE_COMMIT_TARGET="$(MKT_PROJECT_VERSION)" \
mkt-gitea-release
.PHONY: update-changelog
update-changelog:
$(MAKE) changelog
git add CHANGELOG.md
git commit -m "chore: update changelog"
git push
.PHONY: changelog
changelog:
git fetch --prune-tags
$(MAKE) MKT_GIT_CHGLOG_PROJECT_ORG=$(MKT_GITEA_RELEASE_ORG) MKT_GIT_CHGLOG_PROJECT_NAME=$(MKT_GITEA_RELEASE_PROJECT) mkt-changelog
```
Pour générer une release sur votre projet, il vous suffira ensuite de faire:
```shell
make release
```

View File

@ -3,7 +3,7 @@
set -e
TASKS_DIR=".mktools"
TASKS_FILES="webdav gitea"
TASKS_FILES="webdav gitea changelog version checkmake"
main() {
echo "Creating directory '$TASKS_DIR/'"

112
tasks/changelog.mk Normal file
View File

@ -0,0 +1,112 @@
MKT_GIT_CHGLOG_VERSION ?= 0.15.4
MKT_GIT_CHGLOG_DOWNLOAD_URL ?= https://github.com/git-chglog/git-chglog/releases/download/v$(MKT_GIT_CHGLOG_VERSION)/git-chglog_$(MKT_GIT_CHGLOG_VERSION)_linux_amd64.tar.gz
MKT_GIT_CHGLOG_ARGS ?= --output CHANGELOG.md
MKT_GIT_CHGLOG_PROJECT_ORG ?=
export MKT_GIT_CHGLOG_PROJECT_ORG
MKT_GIT_CHGLOG_PROJECT_NAME ?=
export MKT_GIT_CHGLOG_PROJECT_NAME
define _MKT_GIT_CHGLOG_CONFIG_SCRIPT =
mkdir -p .chglog
cat > .chglog/config.yml << EOF
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://forge.cadoles.com/${MKT_GIT_CHGLOG_PROJECT_ORG}/${MKT_GIT_CHGLOG_PROJECT_NAME}
options:
commits:
filters:
Type:
- feat
- fix
- perf
- refactor
- docs
commit_groups:
title_maps:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
docs: Documentation
header:
pattern: "^(\\\\w*)(?:\\\\(([\\\\w\\\\$\\\\.\\\\-\\\\*\\\\s]*)\\\\))?\\\\:\\\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
issues:
prefix:
- '#'
EOF
endef
export MKT_GIT_CHGLOG_CONFIG_SCRIPT = $(value _MKT_GIT_CHGLOG_CONFIG_SCRIPT)
define _MKT_GIT_CHGLOG_TEMPLATE_SCRIPT =
mkdir -p .chglog
cat > .chglog/CHANGELOG.tpl.md << EOF
{{ if .Versions -}}
{{ if .Unreleased.CommitGroups -}}
<a name="unreleased"></a>
## [Unreleased]
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ else }}
_Nothing functionally significant._
{{ end -}}
{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ \$latest := index .Versions 0 }}{{ \$latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
EOF
endef
export MKT_GIT_CHGLOG_TEMPLATE_SCRIPT = $(value _MKT_GIT_CHGLOG_TEMPLATE_SCRIPT)
mkt-changelog: tools/git-chglog/bin/git-chglog .chglog/config.yml .chglog/CHANGELOG.tpl.md
tools/git-chglog/bin/git-chglog $(MKT_GIT_CHGLOG_ARGS)
.chglog/config.yml:
@eval "$$MKT_GIT_CHGLOG_CONFIG_SCRIPT"
.chglog/CHANGELOG.tpl.md:
@eval "$$MKT_GIT_CHGLOG_TEMPLATE_SCRIPT"
tools/git-chglog/bin/git-chglog:
mkdir -p tools/git-chglog/bin
grep -qF -- "tools/" ".gitignore" 2>/dev/null || echo "tools/" >> ".gitignore"
( cd tools/git-chglog/bin && curl -sL "$(MKT_GIT_CHGLOG_DOWNLOAD_URL)" | tar -xz git-chglog )

8
tasks/checkmake.mk Normal file
View File

@ -0,0 +1,8 @@
MKT_CHECKMAKE_VERSION ?= 0.2.2
MKT_CHECKMAKE_URL ?= https://github.com/mrtazz/checkmake/releases/download/$(MKT_CHECKMAKE_VERSION)/checkmake-$(MKT_CHECKMAKE_VERSION).linux.amd64
tools/checkmake/bin/checkmake:
mkdir -p tools/checkmake/bin
grep -qF -- "tools/" ".gitignore" 2>/dev/null || echo "tools/" >> ".gitignore"
curl -sL -o tools/checkmake/bin/checkmake "$(MKT_CHECKMAKE_URL)"
chmod +x tools/checkmake/bin/checkmake

View File

@ -1,7 +1,7 @@
MKT_GITEA_RELEASE_PROJECT ?=
MKT_GITEA_RELEASE_ORG ?=
MKT_GITEA_RELEASE_BASE_URL ?= https://forge.cadoles.com
MKT_GITEA_RELEASE_VERSION ?=
MKT_GITEA_RELEASE_VERSION ?= $(MKT_PROJECT_VERSION)
MKT_GITEA_RELEASE_COMMIT_TARGET ?= $(shell git rev-parse HEAD)
MKT_GITEA_RELEASE_IS_DRAFT ?= false
MKT_GITEA_RELEASE_BODY ?=
@ -26,4 +26,5 @@ mkt-gitea-release: tools/gitea-release/bin/gitea-release.sh
tools/gitea-release/bin/gitea-release.sh:
mkdir -p tools/gitea-release/bin
curl --output tools/gitea-release/bin/gitea-release.sh https://forge.cadoles.com/Cadoles/Jenkins/raw/branch/master/resources/com/cadoles/gitea/gitea-release.sh
chmod +x tools/gitea-release/bin/gitea-release.sh
chmod +x tools/gitea-release/bin/gitea-release.sh
grep -qF -- "tools/" ".gitignore" 2>/dev/null || echo "tools/" >> ".gitignore"

37
tasks/version.mk Normal file
View File

@ -0,0 +1,37 @@
MKT_PROJECT_VERSION_TIMEZONE ?= Europe/Paris
MKT_PROJECT_VERSION_BRANCH_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
MKT_PROJECT_VERSION_CLEANED_BRANCH_NAME ?= $(shell echo $(MKT_PROJECT_VERSION_BRANCH_NAME) | tr '[:upper:]' '[:lower:]' | sed -e 's/[-_ ]//g')
ifeq ($(MKT_PROJECT_VERSION_CLEANED_BRANCH_NAME),master)
MKT_PROJECT_VERSION_CHANNEL = stable
else ifeq ($(MKT_PROJECT_VERSION_CLEANED_BRANCH_NAME),staging)
MKT_PROJECT_VERSION_CHANNEL = testing
else
MKT_PROJECT_VERSION_CHANNEL = $(MKT_PROJECT_VERSION_CLEANED_BRANCH_NAME)
endif
ifeq ($(MKT_PROJECT_VERSION_CHANNEL),develop)
MKT_PROJECT_SHORT_VERSION_CHANNEL ?= dev
else ifneq ($(filter $(MKT_PROJECT_VERSION_CHANNEL),testing staging),)
MKT_PROJECT_SHORT_VERSION_CHANNEL ?= tst
else ifneq ($(filter $(MKT_PROJECT_VERSION_CHANNEL),stable master),)
MKT_PROJECT_SHORT_VERSION_CHANNEL ?= stb
else
MKT_PROJECT_SHORT_VERSION_CHANNEL ?= $(shell echo "$(MKT_PROJECT_VERSION_CHANNEL)" | sed -e 's/[aeiouy]//g' | cut -c1-3)
endif
MKT_PROJECT_VERSION_COMMIT_TIMESTAMP ?= $(shell git show -s --format=%ct)
MKT_PROJECT_VERSION_DATE ?= $(shell TZ=$(MKT_PROJECT_VERSION_TIMEZONE) date -d '@$(MKT_PROJECT_VERSION_COMMIT_TIMESTAMP)' +%Y.%-m.%-d)
MKT_PROJECT_VERSION_TIMESTAMP ?= $(shell TZ=$(MKT_PROJECT_VERSION_TIMEZONE) date -d '@$(MKT_PROJECT_VERSION_COMMIT_TIMESTAMP)' +%-H%M)
MKT_PROJECT_VERSION ?= $(MKT_PROJECT_VERSION_DATE)-$(MKT_PROJECT_VERSION_CHANNEL).$(MKT_PROJECT_VERSION_TIMESTAMP).$(shell git rev-parse --short HEAD)
MKT_PROJECT_SHORT_VERSION ?= $(MKT_PROJECT_VERSION_DATE)-$(MKT_PROJECT_SHORT_VERSION_CHANNEL).$(MKT_PROJECT_VERSION_TIMESTAMP)
.PHONY: mkt-project-version
mkt-project-version:
@echo $(MKT_PROJECT_VERSION)
.PHONY: mkt-project-short-version
mkt-project-short-version:
@echo $(MKT_PROJECT_SHORT_VERSION)