3
0
Fork 0
mirror of https://gitea.com/docker/metadata-action.git synced 2024-11-25 13:39:33 +01:00

Merge pull request #77 from crazy-max/rename-bake-target

Rename bake target
This commit is contained in:
CrazyMax 2021-05-10 15:59:40 +02:00 committed by GitHub
commit 8d3d13fe48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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 = {