Rename bake target

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-05-10 15:54:35 +02:00
parent c8b87a08b5
commit ed01528979
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
9 changed files with 21 additions and 21 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -152,14 +152,14 @@ jobs:
This action also handles a bake definition file that can be used with the
[Docker Bake action](https://github.com/docker/bake-action). You just have to declare an empty target named
`ghaction-docker-meta` and inherit from it.
`docker-metadata-action` and inherit from it.
```hcl
// docker-bake.hcl
target "ghaction-docker-meta" {}
target "docker-metadata-action" {}
target "build" {
inherits = ["ghaction-docker-meta"]
inherits = ["docker-metadata-action"]
context = "./"
dockerfile = "Dockerfile"
platforms = ["linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/386", "linux/ppc64le"]
@ -210,7 +210,7 @@ Content of `${{ steps.meta.outputs.bake-file }}` file will look like this with `
```json
{
"target": {
"ghaction-docker-meta": {
"docker-metadata-action": {
"tags": [
"name/app:1.2.3",
"name/app:1.2",
@ -263,7 +263,7 @@ Following inputs can be used as `step.with` keys
| `labels` | List | List of custom labels |
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
| `bake-target` | String | Bake target name (default `ghaction-docker-meta`) |
| `bake-target` | String | Bake target name (default `docker-metadata-action`) |
### outputs

View File

@ -5,7 +5,7 @@ import * as path from 'path';
import * as context from '../src/context';
jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
const tmpDir = path.join('/tmp/.ghaction-docker-meta-jest').split(path.sep).join(path.posix.sep);
const tmpDir = path.join('/tmp/.docker-metadata-action-jest').split(path.sep).join(path.posix.sep);
if (!fs.existsSync(tmpDir)) {
fs.mkdirSync(tmpDir, {recursive: true});
}

View File

@ -2382,7 +2382,7 @@ describe('bake', () => {
} as Inputs,
{
"target": {
"ghaction-docker-meta": {
"docker-metadata-action": {
"tags": [
"user/app:dev",
"user/app:my",
@ -2419,7 +2419,7 @@ describe('bake', () => {
} as Inputs,
{
"target": {
"ghaction-docker-meta": {
"docker-metadata-action": {
"tags": [
"user/app:dev",
"user/app:my",
@ -2500,7 +2500,7 @@ describe('bake', () => {
} as Inputs,
{
"target": {
"ghaction-docker-meta": {
"docker-metadata-action": {
"tags": [
"user/app:20200110",
"user/app:my",
@ -2541,7 +2541,7 @@ describe('bake', () => {
} as Inputs,
{
"target": {
"ghaction-docker-meta": {
"docker-metadata-action": {
"tags": [
"org/app:1.1.1",
"org/app:1.1",
@ -2589,7 +2589,7 @@ describe('bake', () => {
} as Inputs,
{
"target": {
"ghaction-docker-meta": {
"docker-metadata-action": {
"tags": [
"org/app:my",
"org/app:custom",
@ -2630,7 +2630,7 @@ describe('bake', () => {
} as Inputs,
{
"target": {
"ghaction-docker-meta": {
"docker-metadata-action": {
"tags": [
"org/app:v1.1.1",
"org/app:latest"

View File

@ -26,7 +26,7 @@ inputs:
description: 'Separator to use for labels output (default \n)'
required: false
bake-target:
description: 'Bake target name (default ghaction-docker-meta)'
description: 'Bake target name (default docker-metadata-action)'
required: false
github-token:
description: 'GitHub Token as provided by secrets'

6
dist/index.js generated vendored
View File

@ -49,7 +49,7 @@ const path = __importStar(__webpack_require__(5622));
let _tmpDir;
function tmpDir() {
if (!_tmpDir) {
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ghaction-docker-meta-')).split(path.sep).join(path.posix.sep);
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-')).split(path.sep).join(path.posix.sep);
}
return _tmpDir;
}
@ -62,7 +62,7 @@ function getInputs() {
labels: getInputList('labels', true),
sepTags: core.getInput('sep-tags') || `\n`,
sepLabels: core.getInput('sep-labels') || `\n`,
bakeTarget: core.getInput('bake-target') || `ghaction-docker-meta`,
bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,
githubToken: core.getInput('github-token')
};
}
@ -649,7 +649,7 @@ class Meta {
}
jsonLabels[matches[1]] = matches[2];
}
const bakeFile = path.join(context_1.tmpDir(), 'ghaction-docker-meta-bake.json').split(path.sep).join(path.posix.sep);
const bakeFile = path.join(context_1.tmpDir(), 'docker-metadata-action-bake.json').split(path.sep).join(path.posix.sep);
fs.writeFileSync(bakeFile, JSON.stringify({
target: {
[this.inputs.bakeTarget]: {

View File

@ -20,7 +20,7 @@ export interface Inputs {
export function tmpDir(): string {
if (!_tmpDir) {
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ghaction-docker-meta-')).split(path.sep).join(path.posix.sep);
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-')).split(path.sep).join(path.posix.sep);
}
return _tmpDir;
}
@ -33,7 +33,7 @@ export function getInputs(): Inputs {
labels: getInputList('labels', true),
sepTags: core.getInput('sep-tags') || `\n`,
sepLabels: core.getInput('sep-labels') || `\n`,
bakeTarget: core.getInput('bake-target') || `ghaction-docker-meta`,
bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,
githubToken: core.getInput('github-token')
};
}

View File

@ -322,7 +322,7 @@ export class Meta {
jsonLabels[matches[1]] = matches[2];
}
const bakeFile = path.join(tmpDir(), 'ghaction-docker-meta-bake.json').split(path.sep).join(path.posix.sep);
const bakeFile = path.join(tmpDir(), 'docker-metadata-action-bake.json').split(path.sep).join(path.posix.sep);
fs.writeFileSync(
bakeFile,
JSON.stringify(

View File

@ -1,4 +1,4 @@
target "ghaction-docker-meta" {}
target "docker-metadata-action" {}
group "default" {
targets = ["db", "app"]
@ -14,7 +14,7 @@ target "db" {
}
target "app" {
inherits = ["ghaction-docker-meta"]
inherits = ["docker-metadata-action"]
context = "./test"
dockerfile = "Dockerfile"
args = {