Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3a3bb3a817 | ||
|
6200091c0f | ||
|
d26b8cd003 | ||
|
03cec7cbca | ||
|
e4f548552d | ||
|
a67f45cb0f | ||
|
66b9054417 | ||
|
b127c18eb4 | ||
|
401bfc308e | ||
|
ad2fba2495 |
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -29,6 +29,6 @@ jobs:
|
|||||||
targets: test
|
targets: test
|
||||||
-
|
-
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v2
|
||||||
with:
|
with:
|
||||||
file: ./coverage/clover.xml
|
file: ./coverage/clover.xml
|
||||||
|
@@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
GitHub Action to extract metadata (tags, labels) for Docker. This action is particularly useful if used with
|
GitHub Action to extract metadata from Git reference and GitHub events.
|
||||||
[Docker Build Push](https://github.com/docker/build-push-action) action.
|
This action is particularly useful if used with [Docker Build Push](https://github.com/docker/build-push-action) action to tag and label Docker images.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -612,6 +612,7 @@ attributes are available:
|
|||||||
| `{{branch}}` | `master` |
|
| `{{branch}}` | `master` |
|
||||||
| `{{tag}}` | `v1.2.3` |
|
| `{{tag}}` | `v1.2.3` |
|
||||||
| `{{sha}}` | `90dd603` |
|
| `{{sha}}` | `90dd603` |
|
||||||
|
| `{{date 'YYYYMMDD'}}` | `20210326` |
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
tags: |
|
tags: |
|
||||||
|
@@ -585,16 +585,18 @@ describe('push', () => {
|
|||||||
images: ['user/app'],
|
images: ['user/app'],
|
||||||
tags: [
|
tags: [
|
||||||
`type=raw,value=mytag-{{branch}}`,
|
`type=raw,value=mytag-{{branch}}`,
|
||||||
|
`type=raw,value=mytag-{{date 'YYYYMMDD'}}`,
|
||||||
`type=raw,value=mytag-{{tag}}`
|
`type=raw,value=mytag-{{tag}}`
|
||||||
],
|
],
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
main: 'mytag-master',
|
main: 'mytag-master',
|
||||||
partial: ['mytag-'],
|
partial: ['mytag-20200110', 'mytag-'],
|
||||||
latest: false
|
latest: false
|
||||||
} as Version,
|
} as Version,
|
||||||
[
|
[
|
||||||
'user/app:mytag-master',
|
'user/app:mytag-master',
|
||||||
|
'user/app:mytag-20200110',
|
||||||
'user/app:mytag-'
|
'user/app:mytag-'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
48
dist/index.js
generated
vendored
48
dist/index.js
generated
vendored
@@ -682,6 +682,7 @@ class Meta {
|
|||||||
}
|
}
|
||||||
setGlobalExp(val) {
|
setGlobalExp(val) {
|
||||||
const ctx = this.context;
|
const ctx = this.context;
|
||||||
|
const currentDate = this.date;
|
||||||
return handlebars.compile(val)({
|
return handlebars.compile(val)({
|
||||||
branch: function () {
|
branch: function () {
|
||||||
if (!/^refs\/heads\//.test(ctx.ref)) {
|
if (!/^refs\/heads\//.test(ctx.ref)) {
|
||||||
@@ -697,6 +698,9 @@ class Meta {
|
|||||||
},
|
},
|
||||||
sha: function () {
|
sha: function () {
|
||||||
return ctx.sha.substr(0, 7);
|
return ctx.sha.substr(0, 7);
|
||||||
|
},
|
||||||
|
date: function (format) {
|
||||||
|
return moment_1.default(currentDate).utc().format(format);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1135,7 +1139,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.notice = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
||||||
const command_1 = __nccwpck_require__(7351);
|
const command_1 = __nccwpck_require__(7351);
|
||||||
const file_command_1 = __nccwpck_require__(717);
|
const file_command_1 = __nccwpck_require__(717);
|
||||||
const utils_1 = __nccwpck_require__(5278);
|
const utils_1 = __nccwpck_require__(5278);
|
||||||
@@ -1313,19 +1317,30 @@ exports.debug = debug;
|
|||||||
/**
|
/**
|
||||||
* Adds an error issue
|
* Adds an error issue
|
||||||
* @param message error issue message. Errors will be converted to string via toString()
|
* @param message error issue message. Errors will be converted to string via toString()
|
||||||
|
* @param properties optional properties to add to the annotation.
|
||||||
*/
|
*/
|
||||||
function error(message) {
|
function error(message, properties = {}) {
|
||||||
command_1.issue('error', message instanceof Error ? message.toString() : message);
|
command_1.issueCommand('error', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
||||||
}
|
}
|
||||||
exports.error = error;
|
exports.error = error;
|
||||||
/**
|
/**
|
||||||
* Adds an warning issue
|
* Adds a warning issue
|
||||||
* @param message warning issue message. Errors will be converted to string via toString()
|
* @param message warning issue message. Errors will be converted to string via toString()
|
||||||
|
* @param properties optional properties to add to the annotation.
|
||||||
*/
|
*/
|
||||||
function warning(message) {
|
function warning(message, properties = {}) {
|
||||||
command_1.issue('warning', message instanceof Error ? message.toString() : message);
|
command_1.issueCommand('warning', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
||||||
}
|
}
|
||||||
exports.warning = warning;
|
exports.warning = warning;
|
||||||
|
/**
|
||||||
|
* Adds a notice issue
|
||||||
|
* @param message notice issue message. Errors will be converted to string via toString()
|
||||||
|
* @param properties optional properties to add to the annotation.
|
||||||
|
*/
|
||||||
|
function notice(message, properties = {}) {
|
||||||
|
command_1.issueCommand('notice', utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message);
|
||||||
|
}
|
||||||
|
exports.notice = notice;
|
||||||
/**
|
/**
|
||||||
* Writes info to log with console.log.
|
* Writes info to log with console.log.
|
||||||
* @param message info message
|
* @param message info message
|
||||||
@@ -1459,7 +1474,7 @@ exports.issueCommand = issueCommand;
|
|||||||
// We use any as a valid input type
|
// We use any as a valid input type
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.toCommandValue = void 0;
|
exports.toCommandProperties = exports.toCommandValue = void 0;
|
||||||
/**
|
/**
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
* @param input input to sanitize into a string
|
* @param input input to sanitize into a string
|
||||||
@@ -1474,6 +1489,25 @@ function toCommandValue(input) {
|
|||||||
return JSON.stringify(input);
|
return JSON.stringify(input);
|
||||||
}
|
}
|
||||||
exports.toCommandValue = toCommandValue;
|
exports.toCommandValue = toCommandValue;
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param annotationProperties
|
||||||
|
* @returns The command properties to send with the actual annotation command
|
||||||
|
* See IssueCommandProperties: https://github.com/actions/runner/blob/main/src/Runner.Worker/ActionCommandManager.cs#L646
|
||||||
|
*/
|
||||||
|
function toCommandProperties(annotationProperties) {
|
||||||
|
if (!Object.keys(annotationProperties).length) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
title: annotationProperties.title,
|
||||||
|
line: annotationProperties.startLine,
|
||||||
|
endLine: annotationProperties.endLine,
|
||||||
|
col: annotationProperties.startColumn,
|
||||||
|
endColumn: annotationProperties.endColumn
|
||||||
|
};
|
||||||
|
}
|
||||||
|
exports.toCommandProperties = toCommandProperties;
|
||||||
//# sourceMappingURL=utils.js.map
|
//# sourceMappingURL=utils.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
],
|
],
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.4.0",
|
"@actions/core": "^1.5.0",
|
||||||
"@actions/github": "^5.0.0",
|
"@actions/github": "^5.0.0",
|
||||||
"@renovate/pep440": "^1.0.0",
|
"@renovate/pep440": "^1.0.0",
|
||||||
"csv-parse": "^4.16.0",
|
"csv-parse": "^4.16.0",
|
||||||
|
@@ -323,6 +323,7 @@ export class Meta {
|
|||||||
|
|
||||||
private setGlobalExp(val): string {
|
private setGlobalExp(val): string {
|
||||||
const ctx = this.context;
|
const ctx = this.context;
|
||||||
|
const currentDate = this.date;
|
||||||
return handlebars.compile(val)({
|
return handlebars.compile(val)({
|
||||||
branch: function () {
|
branch: function () {
|
||||||
if (!/^refs\/heads\//.test(ctx.ref)) {
|
if (!/^refs\/heads\//.test(ctx.ref)) {
|
||||||
@@ -338,6 +339,9 @@ export class Meta {
|
|||||||
},
|
},
|
||||||
sha: function () {
|
sha: function () {
|
||||||
return ctx.sha.substr(0, 7);
|
return ctx.sha.substr(0, 7);
|
||||||
|
},
|
||||||
|
date: function (format) {
|
||||||
|
return moment(currentDate).utc().format(format);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
"@actions/core@^1.4.0":
|
"@actions/core@^1.5.0":
|
||||||
version "1.4.0"
|
version "1.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.4.0.tgz#cf2e6ee317e314b03886adfeb20e448d50d6e524"
|
resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.5.0.tgz#885b864700001a1b9a6fba247833a036e75ad9d3"
|
||||||
integrity sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg==
|
integrity sha512-eDOLH1Nq9zh+PJlYLqEMkS/jLQxhksPNmUGNBHfa4G+tQmnIhzpctxmchETtVGyBOvXgOVVpYuE40+eS4cUnwQ==
|
||||||
|
|
||||||
"@actions/github@^5.0.0":
|
"@actions/github@^5.0.0":
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
|
Reference in New Issue
Block a user