mirror of
https://code.forgejo.org/docker/metadata-action.git
synced 2025-09-15 17:27:00 +00:00
Add global expression "date"
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
a67f45cb0f
commit
e4f548552d
4 changed files with 12 additions and 1 deletions
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
|
@ -682,6 +682,7 @@ class Meta {
|
|||
}
|
||||
setGlobalExp(val) {
|
||||
const ctx = this.context;
|
||||
const currentDate = this.date;
|
||||
return handlebars.compile(val)({
|
||||
branch: function () {
|
||||
if (!/^refs\/heads\//.test(ctx.ref)) {
|
||||
|
@ -697,6 +698,9 @@ class Meta {
|
|||
},
|
||||
sha: function () {
|
||||
return ctx.sha.substr(0, 7);
|
||||
},
|
||||
date: function (format) {
|
||||
return moment_1.default(currentDate).utc().format(format);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue