Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
2e1a5c7fa4 | ||
|
1a678de43d | ||
|
84b9e75d44 |
@@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.3.0 (2021/04/07)
|
||||||
|
|
||||||
|
* Allow overriding flavor (#63)
|
||||||
|
* Prefix/suffix not taken into account for `match`, `semver` and `schedule` types (#62)
|
||||||
|
|
||||||
## 2.2.1 (2021/04/05)
|
## 2.2.1 (2021/04/05)
|
||||||
|
|
||||||
* Skip and display warning if tag does not match (#59)
|
* Skip and display warning if tag does not match (#59)
|
||||||
|
@@ -1169,6 +1169,47 @@ describe('tag', () => {
|
|||||||
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'tag19',
|
||||||
|
'event_tag_p1-v1.0.0.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=match,pattern=p1-v(\\d.\\d.\\d),group=1`,
|
||||||
|
`type=match,pattern=p1-v(\\d.\\d),group=1,suffix=`,
|
||||||
|
`type=ref,event=pr`,
|
||||||
|
`type=sha`
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`suffix=-dev`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '1.0.0-dev',
|
||||||
|
partial: ['1.0', 'sha-90dd603-dev'],
|
||||||
|
latest: true
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:1.0.0-dev',
|
||||||
|
'org/app:1.0',
|
||||||
|
'org/app:sha-90dd603-dev',
|
||||||
|
'org/app:latest',
|
||||||
|
'ghcr.io/user/app:1.0.0-dev',
|
||||||
|
'ghcr.io/user/app:1.0',
|
||||||
|
'ghcr.io/user/app:sha-90dd603-dev',
|
||||||
|
'ghcr.io/user/app:latest'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"org.opencontainers.image.title=Hello-World",
|
||||||
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.version=1.0.0-dev",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
]
|
]
|
||||||
])('given %p with %p event', tagsLabelsTest);
|
])('given %p with %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
@@ -1578,6 +1619,72 @@ describe('pr', () => {
|
|||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'pr05',
|
||||||
|
'event_pull_request.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=ref,event=pr`
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`prefix=glo-`,
|
||||||
|
`suffix=-bal`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'pr-2-bal',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:pr-2-bal',
|
||||||
|
'ghcr.io/user/app:pr-2-bal'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"org.opencontainers.image.title=Hello-World",
|
||||||
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.version=pr-2-bal",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=1e9249f05bfc090e0688b8fb9c1b347586add504",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'pr06',
|
||||||
|
'event_pull_request.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=ref,event=pr,prefix=`
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`prefix=glo-`,
|
||||||
|
`suffix=-bal`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: '2-bal',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:2-bal',
|
||||||
|
'ghcr.io/user/app:2-bal'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"org.opencontainers.image.title=Hello-World",
|
||||||
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.version=2-bal",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=1e9249f05bfc090e0688b8fb9c1b347586add504",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
]
|
||||||
])('given %p with %p event', tagsLabelsTest);
|
])('given %p with %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1758,6 +1865,39 @@ describe('schedule', () => {
|
|||||||
"org.opencontainers.image.licenses=MIT"
|
"org.opencontainers.image.licenses=MIT"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'schedule07',
|
||||||
|
'event_schedule.env',
|
||||||
|
{
|
||||||
|
images: ['org/app', 'ghcr.io/user/app'],
|
||||||
|
tags: [
|
||||||
|
`type=schedule`,
|
||||||
|
],
|
||||||
|
flavor: [
|
||||||
|
`prefix=glo-`,
|
||||||
|
`suffix=-bal`
|
||||||
|
]
|
||||||
|
} as Inputs,
|
||||||
|
{
|
||||||
|
main: 'glo-nightly-bal',
|
||||||
|
partial: [],
|
||||||
|
latest: false
|
||||||
|
} as Version,
|
||||||
|
[
|
||||||
|
'org/app:glo-nightly-bal',
|
||||||
|
'ghcr.io/user/app:glo-nightly-bal'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"org.opencontainers.image.title=Hello-World",
|
||||||
|
"org.opencontainers.image.description=This your first repo!",
|
||||||
|
"org.opencontainers.image.url=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.source=https://github.com/octocat/Hello-World",
|
||||||
|
"org.opencontainers.image.version=glo-nightly-bal",
|
||||||
|
"org.opencontainers.image.created=2020-01-10T00:30:00.000Z",
|
||||||
|
"org.opencontainers.image.revision=90dd6032fac8bda1b6c4436a2e65de27961ed071",
|
||||||
|
"org.opencontainers.image.licenses=MIT"
|
||||||
|
]
|
||||||
|
],
|
||||||
])('given %p with %p event', tagsLabelsTest);
|
])('given %p with %p event', tagsLabelsTest);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -21,8 +21,6 @@ describe('transform', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Schedule],
|
"priority": DefaultPriorities[Type.Schedule],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "nightly"
|
"pattern": "nightly"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -31,8 +29,6 @@ describe('transform', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Semver],
|
"priority": DefaultPriorities[Type.Semver],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "{{version}}",
|
"pattern": "{{version}}",
|
||||||
"value": ""
|
"value": ""
|
||||||
}
|
}
|
||||||
@@ -42,8 +38,6 @@ describe('transform', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Match],
|
"priority": DefaultPriorities[Type.Match],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "\\d.\\d.\\d",
|
"pattern": "\\d.\\d.\\d",
|
||||||
"group": "0",
|
"group": "0",
|
||||||
"value": ""
|
"value": ""
|
||||||
@@ -54,8 +48,6 @@ describe('transform', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Edge],
|
"priority": DefaultPriorities[Type.Edge],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"branch": ""
|
"branch": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -64,8 +56,6 @@ describe('transform', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Ref],
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"event": RefEvent.Branch
|
"event": RefEvent.Branch
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -74,8 +64,6 @@ describe('transform', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Ref],
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"event": RefEvent.Tag
|
"event": RefEvent.Tag
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -85,7 +73,6 @@ describe('transform', () => {
|
|||||||
"priority": DefaultPriorities[Type.Ref],
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "pr-",
|
"prefix": "pr-",
|
||||||
"suffix": "",
|
|
||||||
"event": RefEvent.PR
|
"event": RefEvent.PR
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -94,8 +81,6 @@ describe('transform', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Raw],
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"value": "foo"
|
"value": "foo"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -104,8 +89,7 @@ describe('transform', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Sha],
|
"priority": DefaultPriorities[Type.Sha],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "sha-",
|
"prefix": "sha-"
|
||||||
"suffix": ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
] as Tag[],
|
] as Tag[],
|
||||||
@@ -135,8 +119,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Schedule],
|
"priority": DefaultPriorities[Type.Schedule],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "{{date 'YYYYMMDD'}}"
|
"pattern": "{{date 'YYYYMMDD'}}"
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -149,8 +131,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Semver],
|
"priority": DefaultPriorities[Type.Semver],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "{{version}}",
|
"pattern": "{{version}}",
|
||||||
"value": ""
|
"value": ""
|
||||||
}
|
}
|
||||||
@@ -164,8 +144,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": "1",
|
"priority": "1",
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "{{version}}",
|
"pattern": "{{version}}",
|
||||||
"value": ""
|
"value": ""
|
||||||
}
|
}
|
||||||
@@ -179,8 +157,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": "1",
|
"priority": "1",
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "{{version}}",
|
"pattern": "{{version}}",
|
||||||
"value": "v1.0.0"
|
"value": "v1.0.0"
|
||||||
}
|
}
|
||||||
@@ -194,8 +170,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Match],
|
"priority": DefaultPriorities[Type.Match],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "v(.*)",
|
"pattern": "v(.*)",
|
||||||
"group": "1",
|
"group": "1",
|
||||||
"value": ""
|
"value": ""
|
||||||
@@ -210,8 +184,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Match],
|
"priority": DefaultPriorities[Type.Match],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "^v(\\d.\\d.\\d)$",
|
"pattern": "^v(\\d.\\d.\\d)$",
|
||||||
"group": "1",
|
"group": "1",
|
||||||
"value": ""
|
"value": ""
|
||||||
@@ -226,8 +198,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": "700",
|
"priority": "700",
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "v(.*)",
|
"pattern": "v(.*)",
|
||||||
"group": "1",
|
"group": "1",
|
||||||
"value": ""
|
"value": ""
|
||||||
@@ -242,8 +212,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Match],
|
"priority": DefaultPriorities[Type.Match],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"pattern": "v(.*)",
|
"pattern": "v(.*)",
|
||||||
"group": "1",
|
"group": "1",
|
||||||
"value": "v1.2.3"
|
"value": "v1.2.3"
|
||||||
@@ -263,8 +231,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Edge],
|
"priority": DefaultPriorities[Type.Edge],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"branch": ""
|
"branch": ""
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -277,8 +243,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Edge],
|
"priority": DefaultPriorities[Type.Edge],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"branch": "master"
|
"branch": "master"
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -291,8 +255,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Ref],
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"event": RefEvent.Tag
|
"event": RefEvent.Tag
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -305,8 +267,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Ref],
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"event": RefEvent.Branch
|
"event": RefEvent.Branch
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -320,7 +280,6 @@ describe('parse', () => {
|
|||||||
"priority": DefaultPriorities[Type.Ref],
|
"priority": DefaultPriorities[Type.Ref],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "pr-",
|
"prefix": "pr-",
|
||||||
"suffix": "",
|
|
||||||
"event": RefEvent.PR
|
"event": RefEvent.PR
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -343,8 +302,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Raw],
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"value": "acustomtag"
|
"value": "acustomtag"
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -362,8 +319,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Raw],
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"value": "acustomtag2"
|
"value": "acustomtag2"
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -376,8 +331,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Raw],
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"value": "acustomtag4"
|
"value": "acustomtag4"
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -390,8 +343,6 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Raw],
|
"priority": DefaultPriorities[Type.Raw],
|
||||||
"enable": "false",
|
"enable": "false",
|
||||||
"prefix": "",
|
|
||||||
"suffix": "",
|
|
||||||
"value": "acustomtag5"
|
"value": "acustomtag5"
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
@@ -404,8 +355,7 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Sha],
|
"priority": DefaultPriorities[Type.Sha],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "sha-",
|
"prefix": "sha-"
|
||||||
"suffix": ""
|
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
false
|
false
|
||||||
@@ -417,8 +367,7 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Sha],
|
"priority": DefaultPriorities[Type.Sha],
|
||||||
"enable": "true",
|
"enable": "true",
|
||||||
"prefix": "",
|
"prefix": ""
|
||||||
"suffix": ""
|
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
false
|
false
|
||||||
@@ -430,8 +379,7 @@ describe('parse', () => {
|
|||||||
attrs: {
|
attrs: {
|
||||||
"priority": DefaultPriorities[Type.Sha],
|
"priority": DefaultPriorities[Type.Sha],
|
||||||
"enable": "false",
|
"enable": "false",
|
||||||
"prefix": "sha-",
|
"prefix": "sha-"
|
||||||
"suffix": ""
|
|
||||||
}
|
}
|
||||||
} as Tag,
|
} as Tag,
|
||||||
false
|
false
|
||||||
|
38
dist/index.js
generated
vendored
38
dist/index.js
generated
vendored
@@ -439,11 +439,11 @@ class Meta {
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
const currentDate = this.date;
|
const currentDate = this.date;
|
||||||
const vraw = handlebars.compile(tag.attrs['pattern'])({
|
const vraw = this.setFlavor(handlebars.compile(tag.attrs['pattern'])({
|
||||||
date: function (format) {
|
date: function (format) {
|
||||||
return moment_1.default(currentDate).utc().format(format);
|
return moment_1.default(currentDate).utc().format(format);
|
||||||
}
|
}
|
||||||
});
|
}), tag);
|
||||||
if (version.main == undefined) {
|
if (version.main == undefined) {
|
||||||
version.main = vraw;
|
version.main = vraw;
|
||||||
}
|
}
|
||||||
@@ -475,24 +475,18 @@ class Meta {
|
|||||||
includePrerelease: true
|
includePrerelease: true
|
||||||
});
|
});
|
||||||
if (semver.prerelease(vraw)) {
|
if (semver.prerelease(vraw)) {
|
||||||
vraw = handlebars.compile('{{version}}')(sver);
|
vraw = this.setFlavor(handlebars.compile('{{version}}')(sver), tag);
|
||||||
if (version.main == undefined) {
|
|
||||||
version.main = vraw;
|
|
||||||
}
|
|
||||||
else if (vraw !== version.main) {
|
|
||||||
version.partial.push(vraw);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vraw = handlebars.compile(tag.attrs['pattern'])(sver);
|
vraw = this.setFlavor(handlebars.compile(tag.attrs['pattern'])(sver), tag);
|
||||||
if (version.main == undefined) {
|
|
||||||
version.main = vraw;
|
|
||||||
}
|
|
||||||
else if (vraw !== version.main) {
|
|
||||||
version.partial.push(vraw);
|
|
||||||
}
|
|
||||||
latest = true;
|
latest = true;
|
||||||
}
|
}
|
||||||
|
if (version.main == undefined) {
|
||||||
|
version.main = vraw;
|
||||||
|
}
|
||||||
|
else if (vraw !== version.main) {
|
||||||
|
version.partial.push(vraw);
|
||||||
|
}
|
||||||
if (version.latest == undefined) {
|
if (version.latest == undefined) {
|
||||||
version.latest = this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true';
|
version.latest = this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true';
|
||||||
}
|
}
|
||||||
@@ -526,7 +520,7 @@ class Meta {
|
|||||||
core.warning(`Group ${tag.attrs['group']} does not exist for ${tag.attrs['pattern']} pattern.`);
|
core.warning(`Group ${tag.attrs['group']} does not exist for ${tag.attrs['pattern']} pattern.`);
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
vraw = tmatch[tag.attrs['group']];
|
vraw = this.setFlavor(tmatch[tag.attrs['group']], tag);
|
||||||
latest = true;
|
latest = true;
|
||||||
if (version.main == undefined) {
|
if (version.main == undefined) {
|
||||||
version.main = vraw;
|
version.main = vraw;
|
||||||
@@ -640,13 +634,13 @@ class Meta {
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
setFlavor(val, tag) {
|
setFlavor(val, tag) {
|
||||||
if (tag.attrs['prefix'].length > 0) {
|
if (tag.attrs.hasOwnProperty('prefix')) {
|
||||||
val = `${tag.attrs['prefix']}${val}`;
|
val = `${tag.attrs['prefix']}${val}`;
|
||||||
}
|
}
|
||||||
else if (this.flavor.prefix.length > 0) {
|
else if (this.flavor.prefix.length > 0) {
|
||||||
val = `${this.flavor.prefix}${val}`;
|
val = `${this.flavor.prefix}${val}`;
|
||||||
}
|
}
|
||||||
if (tag.attrs['suffix'].length > 0) {
|
if (tag.attrs.hasOwnProperty('suffix')) {
|
||||||
val = `${val}${tag.attrs['suffix']}`;
|
val = `${val}${tag.attrs['suffix']}`;
|
||||||
}
|
}
|
||||||
else if (this.flavor.suffix.length > 0) {
|
else if (this.flavor.suffix.length > 0) {
|
||||||
@@ -918,12 +912,6 @@ function Parse(s) {
|
|||||||
if (!tag.attrs.hasOwnProperty('priority')) {
|
if (!tag.attrs.hasOwnProperty('priority')) {
|
||||||
tag.attrs['priority'] = exports.DefaultPriorities[tag.type];
|
tag.attrs['priority'] = exports.DefaultPriorities[tag.type];
|
||||||
}
|
}
|
||||||
if (!tag.attrs.hasOwnProperty('prefix')) {
|
|
||||||
tag.attrs['prefix'] = '';
|
|
||||||
}
|
|
||||||
if (!tag.attrs.hasOwnProperty('suffix')) {
|
|
||||||
tag.attrs['suffix'] = '';
|
|
||||||
}
|
|
||||||
if (!['true', 'false'].includes(tag.attrs['enable'])) {
|
if (!['true', 'false'].includes(tag.attrs['enable'])) {
|
||||||
throw new Error(`Invalid value for enable attribute: ${tag.attrs['enable']}`);
|
throw new Error(`Invalid value for enable attribute: ${tag.attrs['enable']}`);
|
||||||
}
|
}
|
||||||
|
38
src/meta.ts
38
src/meta.ts
@@ -99,11 +99,14 @@ export class Meta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const currentDate = this.date;
|
const currentDate = this.date;
|
||||||
const vraw = handlebars.compile(tag.attrs['pattern'])({
|
const vraw = this.setFlavor(
|
||||||
date: function (format) {
|
handlebars.compile(tag.attrs['pattern'])({
|
||||||
return moment(currentDate).utc().format(format);
|
date: function (format) {
|
||||||
}
|
return moment(currentDate).utc().format(format);
|
||||||
});
|
}
|
||||||
|
}),
|
||||||
|
tag
|
||||||
|
);
|
||||||
|
|
||||||
if (version.main == undefined) {
|
if (version.main == undefined) {
|
||||||
version.main = vraw;
|
version.main = vraw;
|
||||||
@@ -138,21 +141,16 @@ export class Meta {
|
|||||||
includePrerelease: true
|
includePrerelease: true
|
||||||
});
|
});
|
||||||
if (semver.prerelease(vraw)) {
|
if (semver.prerelease(vraw)) {
|
||||||
vraw = handlebars.compile('{{version}}')(sver);
|
vraw = this.setFlavor(handlebars.compile('{{version}}')(sver), tag);
|
||||||
if (version.main == undefined) {
|
|
||||||
version.main = vraw;
|
|
||||||
} else if (vraw !== version.main) {
|
|
||||||
version.partial.push(vraw);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
vraw = handlebars.compile(tag.attrs['pattern'])(sver);
|
vraw = this.setFlavor(handlebars.compile(tag.attrs['pattern'])(sver), tag);
|
||||||
if (version.main == undefined) {
|
|
||||||
version.main = vraw;
|
|
||||||
} else if (vraw !== version.main) {
|
|
||||||
version.partial.push(vraw);
|
|
||||||
}
|
|
||||||
latest = true;
|
latest = true;
|
||||||
}
|
}
|
||||||
|
if (version.main == undefined) {
|
||||||
|
version.main = vraw;
|
||||||
|
} else if (vraw !== version.main) {
|
||||||
|
version.partial.push(vraw);
|
||||||
|
}
|
||||||
if (version.latest == undefined) {
|
if (version.latest == undefined) {
|
||||||
version.latest = this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true';
|
version.latest = this.flavor.latest == 'auto' ? latest : this.flavor.latest == 'true';
|
||||||
}
|
}
|
||||||
@@ -189,7 +187,7 @@ export class Meta {
|
|||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
vraw = tmatch[tag.attrs['group']];
|
vraw = this.setFlavor(tmatch[tag.attrs['group']], tag);
|
||||||
latest = true;
|
latest = true;
|
||||||
|
|
||||||
if (version.main == undefined) {
|
if (version.main == undefined) {
|
||||||
@@ -317,12 +315,12 @@ export class Meta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setFlavor(val: string, tag: tcl.Tag): string {
|
private setFlavor(val: string, tag: tcl.Tag): string {
|
||||||
if (tag.attrs['prefix'].length > 0) {
|
if (tag.attrs.hasOwnProperty('prefix')) {
|
||||||
val = `${tag.attrs['prefix']}${val}`;
|
val = `${tag.attrs['prefix']}${val}`;
|
||||||
} else if (this.flavor.prefix.length > 0) {
|
} else if (this.flavor.prefix.length > 0) {
|
||||||
val = `${this.flavor.prefix}${val}`;
|
val = `${this.flavor.prefix}${val}`;
|
||||||
}
|
}
|
||||||
if (tag.attrs['suffix'].length > 0) {
|
if (tag.attrs.hasOwnProperty('suffix')) {
|
||||||
val = `${val}${tag.attrs['suffix']}`;
|
val = `${val}${tag.attrs['suffix']}`;
|
||||||
} else if (this.flavor.suffix.length > 0) {
|
} else if (this.flavor.suffix.length > 0) {
|
||||||
val = `${val}${this.flavor.suffix}`;
|
val = `${val}${this.flavor.suffix}`;
|
||||||
|
@@ -185,12 +185,6 @@ export function Parse(s: string): Tag {
|
|||||||
if (!tag.attrs.hasOwnProperty('priority')) {
|
if (!tag.attrs.hasOwnProperty('priority')) {
|
||||||
tag.attrs['priority'] = DefaultPriorities[tag.type];
|
tag.attrs['priority'] = DefaultPriorities[tag.type];
|
||||||
}
|
}
|
||||||
if (!tag.attrs.hasOwnProperty('prefix')) {
|
|
||||||
tag.attrs['prefix'] = '';
|
|
||||||
}
|
|
||||||
if (!tag.attrs.hasOwnProperty('suffix')) {
|
|
||||||
tag.attrs['suffix'] = '';
|
|
||||||
}
|
|
||||||
if (!['true', 'false'].includes(tag.attrs['enable'])) {
|
if (!['true', 'false'].includes(tag.attrs['enable'])) {
|
||||||
throw new Error(`Invalid value for enable attribute: ${tag.attrs['enable']}`);
|
throw new Error(`Invalid value for enable attribute: ${tag.attrs['enable']}`);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user