2
0
Fork 0
mirror of https://code.forgejo.org/docker/metadata-action.git synced 2025-08-26 16:00:54 +00:00

Add global expression "date"

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-08-19 19:58:11 +02:00
parent a67f45cb0f
commit e4f548552d
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
4 changed files with 12 additions and 1 deletions

View file

@ -323,6 +323,7 @@ export class Meta {
private setGlobalExp(val): string {
const ctx = this.context;
const currentDate = this.date;
return handlebars.compile(val)({
branch: function () {
if (!/^refs\/heads\//.test(ctx.ref)) {
@ -338,6 +339,9 @@ export class Meta {
},
sha: function () {
return ctx.sha.substr(0, 7);
},
date: function (format) {
return moment(currentDate).utc().format(format);
}
});
}