mirror of
https://gitea.com/docker/metadata-action.git
synced 2024-11-25 21:49:33 +01:00
Merge pull request #77 from crazy-max/rename-bake-target
Rename bake target
This commit is contained in:
commit
8d3d13fe48
9 changed files with 21 additions and 21 deletions
BIN
.github/metadata-action.png
vendored
BIN
.github/metadata-action.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 7.5 KiB |
10
README.md
10
README.md
|
@ -152,14 +152,14 @@ jobs:
|
||||||
|
|
||||||
This action also handles a bake definition file that can be used with the
|
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
|
[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
|
```hcl
|
||||||
// docker-bake.hcl
|
// docker-bake.hcl
|
||||||
target "ghaction-docker-meta" {}
|
target "docker-metadata-action" {}
|
||||||
|
|
||||||
target "build" {
|
target "build" {
|
||||||
inherits = ["ghaction-docker-meta"]
|
inherits = ["docker-metadata-action"]
|
||||||
context = "./"
|
context = "./"
|
||||||
dockerfile = "Dockerfile"
|
dockerfile = "Dockerfile"
|
||||||
platforms = ["linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/386", "linux/ppc64le"]
|
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
|
```json
|
||||||
{
|
{
|
||||||
"target": {
|
"target": {
|
||||||
"ghaction-docker-meta": {
|
"docker-metadata-action": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"name/app:1.2.3",
|
"name/app:1.2.3",
|
||||||
"name/app:1.2",
|
"name/app:1.2",
|
||||||
|
@ -263,7 +263,7 @@ Following inputs can be used as `step.with` keys
|
||||||
| `labels` | List | List of custom labels |
|
| `labels` | List | List of custom labels |
|
||||||
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
|
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
|
||||||
| `sep-labels` | String | Separator to use for labels 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
|
### outputs
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import * as path from 'path';
|
||||||
import * as context from '../src/context';
|
import * as context from '../src/context';
|
||||||
|
|
||||||
jest.spyOn(context, 'tmpDir').mockImplementation((): string => {
|
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)) {
|
if (!fs.existsSync(tmpDir)) {
|
||||||
fs.mkdirSync(tmpDir, {recursive: true});
|
fs.mkdirSync(tmpDir, {recursive: true});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2382,7 +2382,7 @@ describe('bake', () => {
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
"target": {
|
"target": {
|
||||||
"ghaction-docker-meta": {
|
"docker-metadata-action": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"user/app:dev",
|
"user/app:dev",
|
||||||
"user/app:my",
|
"user/app:my",
|
||||||
|
@ -2419,7 +2419,7 @@ describe('bake', () => {
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
"target": {
|
"target": {
|
||||||
"ghaction-docker-meta": {
|
"docker-metadata-action": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"user/app:dev",
|
"user/app:dev",
|
||||||
"user/app:my",
|
"user/app:my",
|
||||||
|
@ -2500,7 +2500,7 @@ describe('bake', () => {
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
"target": {
|
"target": {
|
||||||
"ghaction-docker-meta": {
|
"docker-metadata-action": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"user/app:20200110",
|
"user/app:20200110",
|
||||||
"user/app:my",
|
"user/app:my",
|
||||||
|
@ -2541,7 +2541,7 @@ describe('bake', () => {
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
"target": {
|
"target": {
|
||||||
"ghaction-docker-meta": {
|
"docker-metadata-action": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"org/app:1.1.1",
|
"org/app:1.1.1",
|
||||||
"org/app:1.1",
|
"org/app:1.1",
|
||||||
|
@ -2589,7 +2589,7 @@ describe('bake', () => {
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
"target": {
|
"target": {
|
||||||
"ghaction-docker-meta": {
|
"docker-metadata-action": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"org/app:my",
|
"org/app:my",
|
||||||
"org/app:custom",
|
"org/app:custom",
|
||||||
|
@ -2630,7 +2630,7 @@ describe('bake', () => {
|
||||||
} as Inputs,
|
} as Inputs,
|
||||||
{
|
{
|
||||||
"target": {
|
"target": {
|
||||||
"ghaction-docker-meta": {
|
"docker-metadata-action": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"org/app:v1.1.1",
|
"org/app:v1.1.1",
|
||||||
"org/app:latest"
|
"org/app:latest"
|
||||||
|
|
|
@ -26,7 +26,7 @@ inputs:
|
||||||
description: 'Separator to use for labels output (default \n)'
|
description: 'Separator to use for labels output (default \n)'
|
||||||
required: false
|
required: false
|
||||||
bake-target:
|
bake-target:
|
||||||
description: 'Bake target name (default ghaction-docker-meta)'
|
description: 'Bake target name (default docker-metadata-action)'
|
||||||
required: false
|
required: false
|
||||||
github-token:
|
github-token:
|
||||||
description: 'GitHub Token as provided by secrets'
|
description: 'GitHub Token as provided by secrets'
|
||||||
|
|
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
|
@ -49,7 +49,7 @@ const path = __importStar(__webpack_require__(5622));
|
||||||
let _tmpDir;
|
let _tmpDir;
|
||||||
function tmpDir() {
|
function tmpDir() {
|
||||||
if (!_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;
|
return _tmpDir;
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ function getInputs() {
|
||||||
labels: getInputList('labels', true),
|
labels: getInputList('labels', true),
|
||||||
sepTags: core.getInput('sep-tags') || `\n`,
|
sepTags: core.getInput('sep-tags') || `\n`,
|
||||||
sepLabels: core.getInput('sep-labels') || `\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')
|
githubToken: core.getInput('github-token')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -649,7 +649,7 @@ class Meta {
|
||||||
}
|
}
|
||||||
jsonLabels[matches[1]] = matches[2];
|
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({
|
fs.writeFileSync(bakeFile, JSON.stringify({
|
||||||
target: {
|
target: {
|
||||||
[this.inputs.bakeTarget]: {
|
[this.inputs.bakeTarget]: {
|
||||||
|
|
|
@ -20,7 +20,7 @@ export interface Inputs {
|
||||||
|
|
||||||
export function tmpDir(): string {
|
export function tmpDir(): string {
|
||||||
if (!_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;
|
return _tmpDir;
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ export function getInputs(): Inputs {
|
||||||
labels: getInputList('labels', true),
|
labels: getInputList('labels', true),
|
||||||
sepTags: core.getInput('sep-tags') || `\n`,
|
sepTags: core.getInput('sep-tags') || `\n`,
|
||||||
sepLabels: core.getInput('sep-labels') || `\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')
|
githubToken: core.getInput('github-token')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -322,7 +322,7 @@ export class Meta {
|
||||||
jsonLabels[matches[1]] = matches[2];
|
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(
|
fs.writeFileSync(
|
||||||
bakeFile,
|
bakeFile,
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
target "ghaction-docker-meta" {}
|
target "docker-metadata-action" {}
|
||||||
|
|
||||||
group "default" {
|
group "default" {
|
||||||
targets = ["db", "app"]
|
targets = ["db", "app"]
|
||||||
|
@ -14,7 +14,7 @@ target "db" {
|
||||||
}
|
}
|
||||||
|
|
||||||
target "app" {
|
target "app" {
|
||||||
inherits = ["ghaction-docker-meta"]
|
inherits = ["docker-metadata-action"]
|
||||||
context = "./test"
|
context = "./test"
|
||||||
dockerfile = "Dockerfile"
|
dockerfile = "Dockerfile"
|
||||||
args = {
|
args = {
|
||||||
|
|
Loading…
Reference in a new issue