Compare commits

..

146 Commits

Author SHA1 Message Date
CrazyMax
96383f4557 Merge pull request #320 from docker/dependabot/npm_and_yarn/csv-parse-5.5.0
Bump csv-parse from 5.4.0 to 5.5.0
2023-09-12 09:35:54 +02:00
CrazyMax
f138b9677b chore: update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-12 09:34:10 +02:00
dependabot[bot]
9cf7015b15 Bump csv-parse from 5.4.0 to 5.5.0
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.4.0 to 5.5.0.
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.5.0/packages/csv-parse)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-12 07:32:56 +00:00
CrazyMax
5a8a5ff8df Merge pull request #315 from docker/dependabot/npm_and_yarn/handlebars-4.7.8
Bump handlebars from 4.7.7 to 4.7.8
2023-09-12 09:31:05 +02:00
CrazyMax
2279d9af58 chore: update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-12 09:29:13 +02:00
dependabot[bot]
c659933213 Bump handlebars from 4.7.7 to 4.7.8
Bumps [handlebars](https://github.com/handlebars-lang/handlebars.js) from 4.7.7 to 4.7.8.
- [Release notes](https://github.com/handlebars-lang/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/v4.7.8/release-notes.md)
- [Commits](https://github.com/handlebars-lang/handlebars.js/compare/v4.7.7...v4.7.8)

---
updated-dependencies:
- dependency-name: handlebars
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-12 07:24:46 +00:00
CrazyMax
48d23ccc05 Merge pull request #333 from docker/dependabot/npm_and_yarn/actions/core-1.10.1
Bump @actions/core from 1.10.0 to 1.10.1
2023-09-12 09:17:01 +02:00
CrazyMax
b83ffb48d6 chore: update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-12 09:12:10 +02:00
dependabot[bot]
3207f2405f Bump @actions/core from 1.10.0 to 1.10.1
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.10.0 to 1.10.1.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-12 07:00:46 +00:00
CrazyMax
63f4a263e5 Merge pull request #328 from crazy-max/update-node20
chore: node 20 as default runtime
2023-09-12 08:23:31 +02:00
CrazyMax
547dcd6d67 chore: node 20 as default runtime
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-09 18:19:59 +02:00
CrazyMax
450eef4207 chore: update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-09 18:19:58 +02:00
CrazyMax
903f5af663 chore: fix author in package.json
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-09 18:19:58 +02:00
CrazyMax
3634bd57d7 vendor: bump @docker/actions-toolkit from 0.6.0 to 0.12.0
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-09 18:19:58 +02:00
CrazyMax
d3faf0d1af chore: update dev dependencies
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-09 18:19:58 +02:00
CrazyMax
ff376f4737 chore: update to node 20
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-09 18:19:58 +02:00
CrazyMax
79f06a31c0 Merge pull request #330 from frison/master
Update Bake file-reference URI
2023-09-08 11:28:34 +02:00
Tim Frison
6f69513dab Update Bake file-reference URI
Previous URL 404'd

Signed-off-by: Tim Frison <tim.frison@clio.com>
2023-09-07 16:03:19 -06:00
CrazyMax
b67fef219a Merge pull request #324 from crazy-max/ci-concurrency
ci: missing concurrency checks
2023-09-05 11:09:54 +02:00
CrazyMax
51990f24d1 ci: missing concurrency checks
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-09-05 11:02:47 +02:00
CrazyMax
4af6ba2231 Merge pull request #322 from docker/dependabot/github_actions/actions/checkout-4
Bump actions/checkout from 3 to 4
2023-09-05 09:21:23 +02:00
dependabot[bot]
59de4866c5 Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 19:14:07 +00:00
CrazyMax
0f8c876baf Merge pull request #317 from crazy-max/rm-codeowners
chore: remove CODEOWNERS
2023-08-08 12:55:36 +02:00
CrazyMax
389ff6bdd5 chore: remove CODEOWNERS
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-08-08 12:52:23 +02:00
Tõnis Tiigi
2bcfca25d5 Merge pull request #316 from crazy-max/dependabot-update
chore: set increase as versioning strategy
2023-08-08 09:54:38 +03:00
CrazyMax
05b244eb76 chore: set increase as versioning strategy
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-08-08 06:01:53 +02:00
CrazyMax
35e9aff4f5 Merge pull request #306 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.6.0
Bump @docker/actions-toolkit from 0.5.0 to 0.6.0
2023-07-06 09:46:22 +02:00
CrazyMax
1586898b63 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-07-05 12:37:27 +02:00
dependabot[bot]
7a273586e1 Bump @docker/actions-toolkit from 0.5.0 to 0.6.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-28 19:30:46 +00:00
CrazyMax
ef25336f42 Merge pull request #304 from docker/dependabot/npm_and_yarn/semver-7.5.2
Bump semver from 7.5.1 to 7.5.2
2023-06-26 15:15:32 +02:00
CrazyMax
0ab15faee8 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-06-26 15:13:35 +02:00
dependabot[bot]
1ea1b02f9b Bump semver from 7.5.1 to 7.5.2
Bumps [semver](https://github.com/npm/node-semver) from 7.5.1 to 7.5.2.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.5.1...v7.5.2)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-25 12:32:27 +00:00
CrazyMax
818d4b7b91 Merge pull request #302 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.5.0
Bump @docker/actions-toolkit from 0.3.0 to 0.5.0
2023-06-13 12:27:30 +02:00
CrazyMax
948134af5e update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-06-13 12:24:59 +02:00
CrazyMax
ef7eee951a enable comments to avoid breaking change with current impl
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-06-13 12:24:00 +02:00
dependabot[bot]
8ec80c3be6 Bump @docker/actions-toolkit from 0.3.0 to 0.5.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.3.0...v0.5.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-13 10:11:07 +00:00
CrazyMax
38650bbf6b Merge pull request #301 from crazy-max/dedup-labels
dedup and sort labels
2023-06-13 12:02:17 +02:00
CrazyMax
ebbd9b4df7 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-06-13 02:32:15 +02:00
CrazyMax
2dadb92b6b dedup and sort labels
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-06-13 02:31:02 +02:00
CrazyMax
2c0bd771b4 Merge pull request #296 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.3.0
Bump @docker/actions-toolkit from 0.1.0 to 0.3.0
2023-06-07 15:56:56 +02:00
CrazyMax
b10b364e15 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-06-07 15:52:25 +02:00
dependabot[bot]
40a1c6ff52 Bump @docker/actions-toolkit from 0.1.0 to 0.3.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.1.0 to 0.3.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.1.0...v0.3.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-07 13:50:58 +00:00
CrazyMax
be8ea87c5a Merge pull request #294 from docker/dependabot/npm_and_yarn/csv-parse-5.4.0
Bump csv-parse from 5.3.8 to 5.4.0
2023-06-07 15:49:57 +02:00
CrazyMax
dbbf01822b Merge pull request #287 from docker/dependabot/github_actions/docker/bake-action-3
Bump docker/bake-action from 2 to 3
2023-06-02 14:54:17 +02:00
dependabot[bot]
72b4ec2b60 Bump csv-parse from 5.3.8 to 5.4.0
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.3.8 to 5.4.0.
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.4.0/packages/csv-parse)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-05-26 19:57:59 +00:00
dependabot[bot]
00e2c9d34e Bump docker/bake-action from 2 to 3
Bumps [docker/bake-action](https://github.com/docker/bake-action) from 2 to 3.
- [Release notes](https://github.com/docker/bake-action/releases)
- [Commits](https://github.com/docker/bake-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: docker/bake-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-18 19:57:31 +00:00
CrazyMax
c4ee3adeed Merge pull request #285 from docker/dependabot/npm_and_yarn/semver-7.5.0
Bump semver from 7.4.0 to 7.5.0
2023-04-18 09:25:43 +02:00
CrazyMax
3bea1eeada update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-04-18 09:24:34 +02:00
dependabot[bot]
88c7f0d3f6 Bump semver from 7.4.0 to 7.5.0
Bumps [semver](https://github.com/npm/node-semver) from 7.4.0 to 7.5.0.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.4.0...v7.5.0)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-18 07:22:30 +00:00
CrazyMax
101f9cbeaf Merge pull request #286 from docker/dependabot/npm_and_yarn/csv-parse-5.3.8
Bump csv-parse from 5.3.6 to 5.3.8
2023-04-18 09:21:45 +02:00
dependabot[bot]
0e44559303 Bump csv-parse from 5.3.6 to 5.3.8
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.3.6 to 5.3.8.
- [Release notes](https://github.com/adaltas/node-csv/releases)
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.3.8/packages/csv-parse)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-17 19:57:54 +00:00
CrazyMax
517f8b0c3b Merge pull request #281 from docker/dependabot/npm_and_yarn/moment-timezone-0.5.43
Bump moment-timezone from 0.5.42 to 0.5.43
2023-04-17 06:36:44 +02:00
CrazyMax
bfaa9197f7 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-04-17 06:35:13 +02:00
dependabot[bot]
16dbdc96f6 Bump moment-timezone from 0.5.42 to 0.5.43
Bumps [moment-timezone](https://github.com/moment/moment-timezone) from 0.5.42 to 0.5.43.
- [Release notes](https://github.com/moment/moment-timezone/releases)
- [Changelog](https://github.com/moment/moment-timezone/blob/develop/changelog.md)
- [Commits](https://github.com/moment/moment-timezone/compare/0.5.42...0.5.43)

---
updated-dependencies:
- dependency-name: moment-timezone
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-17 04:32:40 +00:00
CrazyMax
bf095b87d3 Merge pull request #284 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.1.0
Bump @docker/actions-toolkit from 0.1.0-beta.19 to 0.1.0
2023-04-17 06:31:29 +02:00
CrazyMax
2ed3c45f27 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-04-17 04:43:59 +02:00
CrazyMax
5076359ba6 fix tests implementation
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-04-17 04:43:58 +02:00
CrazyMax
d8f57c18fa update dev dependencies
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-04-17 04:36:33 +02:00
CrazyMax
80530e08c5 use new implementation from toolkit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-04-17 04:33:51 +02:00
dependabot[bot]
da933fb889 Bump @docker/actions-toolkit from 0.1.0-beta.19 to 0.1.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.1.0-beta.19 to 0.1.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.1.0-beta.19...v0.1.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-11 19:57:48 +00:00
CrazyMax
3f6690a76c Merge pull request #278 from docker/dependabot/npm_and_yarn/moment-timezone-0.5.42
Bump moment-timezone from 0.5.41 to 0.5.42
2023-03-30 13:17:59 +02:00
CrazyMax
dda839d15b update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-30 13:14:41 +02:00
dependabot[bot]
37f1d84442 Bump moment-timezone from 0.5.41 to 0.5.42
Bumps [moment-timezone](https://github.com/moment/moment-timezone) from 0.5.41 to 0.5.42.
- [Release notes](https://github.com/moment/moment-timezone/releases)
- [Changelog](https://github.com/moment/moment-timezone/blob/develop/changelog.md)
- [Commits](https://github.com/moment/moment-timezone/compare/0.5.41...0.5.42)

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>

---
updated-dependencies:
- dependency-name: moment-timezone
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-30 13:13:45 +02:00
CrazyMax
1ce942256d Merge pull request #248 from escemi-tech/add-option-to-choose-between-git-or-workflow-context
allows to specify context to fetch git data
2023-03-30 12:58:07 +02:00
Emilien Escalle
8f8c795666 feat: allows to specify context to fetch git data
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
2023-03-30 12:53:58 +02:00
CrazyMax
9ec57ed1fc Merge pull request #274 from crazy-max/update-workflows
ci: split validate and test workflow
2023-03-15 15:20:07 +00:00
CrazyMax
2bdac1078b Merge pull request #268 from docker/dependabot/npm_and_yarn/moment-timezone-0.5.41
Bump moment-timezone from 0.5.40 to 0.5.41
2023-03-12 12:14:59 +00:00
CrazyMax
9e02960866 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-12 12:59:28 +01:00
dependabot[bot]
ea910e3ad4 Bump moment-timezone from 0.5.40 to 0.5.41
Bumps [moment-timezone](https://github.com/moment/moment-timezone) from 0.5.40 to 0.5.41.
- [Release notes](https://github.com/moment/moment-timezone/releases)
- [Changelog](https://github.com/moment/moment-timezone/blob/develop/changelog.md)
- [Commits](https://github.com/moment/moment-timezone/compare/0.5.40...0.5.41)

---
updated-dependencies:
- dependency-name: moment-timezone
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-12 11:54:47 +00:00
CrazyMax
8b6629002b Merge pull request #271 from docker/dependabot/npm_and_yarn/csv-parse-5.3.6
Bump csv-parse from 5.3.3 to 5.3.6
2023-03-12 11:53:52 +00:00
dependabot[bot]
1db8e21e35 Bump csv-parse from 5.3.3 to 5.3.6
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.3.3 to 5.3.6.
- [Release notes](https://github.com/adaltas/node-csv/releases)
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.3.6/packages/csv-parse)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-12 11:48:00 +00:00
CrazyMax
b30cff8c11 Merge pull request #273 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.1.0-beta.19
Bump @docker/actions-toolkit from 0.1.0-beta.14 to 0.1.0-beta.19
2023-03-12 11:47:04 +00:00
CrazyMax
916b4b90e3 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-12 12:41:51 +01:00
CrazyMax
0ef9f130fa ci: split validate and test workflow
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-03-12 12:36:59 +01:00
dependabot[bot]
f5c49ece12 Bump @docker/actions-toolkit from 0.1.0-beta.14 to 0.1.0-beta.19
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.1.0-beta.14 to 0.1.0-beta.19.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.1.0-beta.14...v0.1.0-beta.19)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-12 11:33:46 +00:00
CrazyMax
18df8a69c4 Merge pull request #265 from docker/dependabot/github_actions/crazy-max/ghaction-dump-context-2
Bump crazy-max/ghaction-dump-context from 1 to 2
2023-03-12 11:32:38 +00:00
CrazyMax
3343011071 Merge pull request #266 from crazy-max/switch-toolkit
switch to actions-toolkit implementation
2023-02-24 19:14:13 +01:00
CrazyMax
0524f79273 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-02-21 09:23:54 +01:00
CrazyMax
b5c378621c switch to actions-toolkit implementation
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-02-21 09:22:45 +01:00
dependabot[bot]
a103499e09 Bump crazy-max/ghaction-dump-context from 1 to 2
Bumps [crazy-max/ghaction-dump-context](https://github.com/crazy-max/ghaction-dump-context) from 1 to 2.
- [Release notes](https://github.com/crazy-max/ghaction-dump-context/releases)
- [Changelog](https://github.com/crazy-max/ghaction-dump-context/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crazy-max/ghaction-dump-context/compare/v1...v2)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-dump-context
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-13 19:58:55 +00:00
CrazyMax
766400ca14 Merge pull request #261 from crazy-max/update-build-push
update build-push-action to v4
2023-01-31 15:10:14 +01:00
CrazyMax
e2ffd4cc94 update build-push-action to v4
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-30 19:37:25 +01:00
CrazyMax
6c3ca5dfa6 Merge pull request #258 from crazy-max/ci-fix-json-job
ci: update json job
2023-01-17 17:03:30 +01:00
CrazyMax
235becadd8 ci: update json job
The step in the json job is no longer necessary since it is
already done by the output-env job.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-13 15:01:54 +01:00
CrazyMax
507c2f2dc5 Merge pull request #257 from crazy-max/env-output
Provide outputs as env vars
2023-01-13 14:33:40 +01:00
CrazyMax
04861f5102 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-13 11:46:25 +01:00
CrazyMax
6729545cde Provide outputs as env vars
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-13 11:46:25 +01:00
CrazyMax
05d22bf317 Merge pull request #256 from crazy-max/fix-readme
Fix README
2023-01-11 16:25:04 +01:00
CrazyMax
70b403b46b Fix README
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-11 16:17:34 +01:00
CrazyMax
9e6ae02878 Merge pull request #252 from docker/dependabot/npm_and_yarn/json5-2.2.3
Bump json5 from 2.2.0 to 2.2.3
2023-01-08 18:33:57 +01:00
dependabot[bot]
3d239e8b8a Bump json5 from 2.2.0 to 2.2.3
Bumps [json5](https://github.com/json5/json5) from 2.2.0 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.0...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-06 09:54:33 +00:00
CrazyMax
7cb52e2750 Merge pull request #251 from chroju/set_timezone
Add tz attribute to handlebar date function
2023-01-06 10:54:03 +01:00
chroju
90a1d5cf21 Add tz attribute to handlebar date function
Signed-off-by: chroju <chroju@users.noreply.github.com>
2023-01-06 18:11:29 +09:00
CrazyMax
c98ac5e987 Merge pull request #249 from crazy-max/fix-readme
readme: fix badges
2022-12-19 21:11:06 +01:00
CrazyMax
44d853bc0a readme: fix badges
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-12-19 21:07:37 +01:00
CrazyMax
d1abf80723 Merge pull request #245 from docker/dependabot/npm_and_yarn/csv-parse-5.3.3
Bump csv-parse from 5.3.1 to 5.3.3
2022-12-19 21:05:43 +01:00
CrazyMax
3358a27538 update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-12-19 21:02:10 +01:00
CrazyMax
314ddf6d4a Merge pull request #242 from docker/dependabot/npm_and_yarn/minimatch-3.1.2
Bump minimatch from 3.0.4 to 3.1.2
2022-11-29 18:53:57 +01:00
dependabot[bot]
b91e8f52b0 Bump csv-parse from 5.3.1 to 5.3.3
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.3.1 to 5.3.3.
- [Release notes](https://github.com/adaltas/node-csv/releases)
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.3.3/packages/csv-parse)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-28 19:04:37 +00:00
dependabot[bot]
fbac5f9bca Bump minimatch from 3.0.4 to 3.1.2
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-10 03:52:53 +00:00
CrazyMax
57396166ad Merge pull request #237 from docker/dependabot/npm_and_yarn/csv-parse-5.3.1
Bump csv-parse from 5.3.0 to 5.3.1
2022-10-17 21:51:54 +02:00
CrazyMax
473bdc561c update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-17 21:50:02 +02:00
dependabot[bot]
ebedea2c18 Bump csv-parse from 5.3.0 to 5.3.1
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.3.0 to 5.3.1.
- [Release notes](https://github.com/adaltas/node-csv/releases)
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.3.1/packages/csv-parse)

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-17 21:49:36 +02:00
Tõnis Tiigi
d00b20e38f Merge pull request #239 from crazy-max/github-sha
revert changes to set associated head sha on pull request event
2022-10-17 09:09:59 -07:00
CrazyMax
a99e71cdc7 revert changes to set associated head sha on pull request event
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-17 11:49:09 +02:00
CrazyMax
12cce9efe0 Merge pull request #236 from crazy-max/setOutput
Remove workaround for setOutput
2022-10-12 08:34:51 +02:00
CrazyMax
f17e188860 Remove workaround for setOutput
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-12 07:07:13 +02:00
CrazyMax
210d783f42 Merge pull request #235 from crazy-max/update-docs
docs: update
2022-10-08 02:32:20 +02:00
CrazyMax
5f26473e44 docs: update links and layout
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-08 02:13:25 +02:00
CrazyMax
49e79e3532 docs: priority attribute
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-08 01:10:48 +02:00
CrazyMax
5ebec4fd21 docs: workflow_dispatch example
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-08 00:48:17 +02:00
CrazyMax
8ed470c7f1 Merge pull request #234 from crazy-max/fix-sha-pr
set associated head sha on pull request event
2022-10-08 00:35:58 +02:00
CrazyMax
61ddee1921 set associated head sha on pull request event
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-08 00:18:51 +02:00
CrazyMax
8671a4f8ec Merge pull request #233 from crazy-max/test-septags
do not trim whitespace for sep-tags and sep-labels inputs
2022-10-07 23:14:46 +02:00
CrazyMax
3862a1b70f do not trim whitespace for sep-tags and sep-labels inputs
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-07 23:10:32 +02:00
CrazyMax
f7c31b1e79 Merge pull request #221 from docker/dependabot/npm_and_yarn/csv-parse-5.3.0
Bump csv-parse from 5.1.0 to 5.3.0
2022-10-07 21:31:34 +02:00
CrazyMax
55b0d953e7 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-07 21:11:07 +02:00
dependabot[bot]
4c6a2cafd0 Bump csv-parse from 5.1.0 to 5.3.0
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.1.0 to 5.3.0.
- [Release notes](https://github.com/adaltas/node-csv/releases)
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.3.0/packages/csv-parse)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-07 19:09:44 +00:00
CrazyMax
6c51f019f8 Merge pull request #220 from docker/dependabot/npm_and_yarn/moment-2.29.4
Bump moment from 2.29.3 to 2.29.4
2022-10-07 21:08:43 +02:00
CrazyMax
5c9aa83b20 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-07 21:01:38 +02:00
dependabot[bot]
30af4d7327 Bump moment from 2.29.3 to 2.29.4
Bumps [moment](https://github.com/moment/moment) from 2.29.3 to 2.29.4.
- [Release notes](https://github.com/moment/moment/releases)
- [Changelog](https://github.com/moment/moment/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/moment/moment/compare/2.29.3...2.29.4)

---
updated-dependencies:
- dependency-name: moment
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-07 18:58:07 +00:00
CrazyMax
594a555a35 Merge pull request #232 from docker/dependabot/npm_and_yarn/actions/github-5.1.1
Bump @actions/github from 5.0.3 to 5.1.1
2022-10-07 20:56:21 +02:00
CrazyMax
7fa87ab51a Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-07 20:54:56 +02:00
dependabot[bot]
02d1a10cce Bump @actions/github from 5.0.3 to 5.1.1
Bumps [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github) from 5.0.3 to 5.1.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

---
updated-dependencies:
- dependency-name: "@actions/github"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-07 18:51:43 +00:00
CrazyMax
58061722cc Merge pull request #231 from docker/dependabot/npm_and_yarn/actions/core-1.10.0
Bump @actions/core from 1.9.1 to 1.10.0
2022-10-07 20:49:23 +02:00
CrazyMax
1c9aacf050 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-10-07 20:44:07 +02:00
dependabot[bot]
1f87faac28 Bump @actions/core from 1.9.1 to 1.10.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.9.1 to 1.10.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-29 19:15:00 +00:00
CrazyMax
59bc9ddfd5 Merge pull request #226 from docker/dependabot/npm_and_yarn/actions/core-1.9.1
Bump @actions/core from 1.9.0 to 1.9.1
2022-08-24 13:16:11 +02:00
CrazyMax
286660a061 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-08-24 12:33:33 +02:00
dependabot[bot]
139c7584e2 Bump @actions/core from 1.9.0 to 1.9.1
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.9.0 to 1.9.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 19:20:50 +00:00
CrazyMax
ee266832e5 Merge pull request #216 from docker/dependabot/npm_and_yarn/actions/core-1.9.0
Bump @actions/core from 1.8.2 to 1.9.0
2022-08-03 12:12:48 +02:00
CrazyMax
ae052be62f Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-08-03 12:10:35 +02:00
dependabot[bot]
98045504c7 Bump @actions/core from 1.8.2 to 1.9.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.8.2 to 1.9.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-15 19:11:29 +00:00
CrazyMax
97c170d70b Merge pull request #210 from docker/dependabot/npm_and_yarn/csv-parse-5.1.0
Bump csv-parse from 5.0.4 to 5.1.0
2022-06-07 11:58:36 +02:00
CrazyMax
44ecceaf69 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-06-07 11:52:29 +02:00
dependabot[bot]
e4d14b2070 Bump csv-parse from 5.0.4 to 5.1.0
Bumps [csv-parse](https://github.com/adaltas/node-csv/tree/HEAD/packages/csv-parse) from 5.0.4 to 5.1.0.
- [Release notes](https://github.com/adaltas/node-csv/releases)
- [Changelog](https://github.com/adaltas/node-csv/blob/master/packages/csv-parse/CHANGELOG.md)
- [Commits](https://github.com/adaltas/node-csv/commits/csv-parse@5.1.0/packages/csv-parse)

---
updated-dependencies:
- dependency-name: csv-parse
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-07 09:50:34 +00:00
CrazyMax
f66710ef6c Merge pull request #209 from docker/dependabot/npm_and_yarn/actions/core-1.8.2
Bump @actions/core from 1.6.0 to 1.8.2
2022-06-07 11:49:03 +02:00
CrazyMax
d6cc766711 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-06-07 11:47:39 +02:00
dependabot[bot]
9c37b1c855 Bump @actions/core from 1.6.0 to 1.8.2
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.6.0 to 1.8.2.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-07 09:43:33 +00:00
CrazyMax
e518b0e7bb Merge pull request #208 from docker/dependabot/npm_and_yarn/actions/github-5.0.3
Bump @actions/github from 5.0.1 to 5.0.3
2022-06-07 11:41:16 +02:00
CrazyMax
7bf589e898 Update generated content
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-06-07 11:37:11 +02:00
CrazyMax
bc6cb60a8a Merge pull request #213 from crazy-max/bump-actions
Bump actions to latest major
2022-06-07 11:22:34 +02:00
CrazyMax
4db6eea5ea Bump actions to latest major
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-05-26 23:43:36 +02:00
dependabot[bot]
b5ee2f25f6 Bump @actions/github from 5.0.1 to 5.0.3
Bumps [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github) from 5.0.1 to 5.0.3.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

---
updated-dependencies:
- dependency-name: "@actions/github"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-13 19:12:51 +00:00
CrazyMax
8d56fe93cf Merge pull request #204 from crazy-max/update-refs
Bump all Docker actions to latest major
2022-05-05 19:46:24 +02:00
CrazyMax
59267481d9 Bump all Docker actions to latest major
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-05-05 19:42:03 +02:00
33 changed files with 5065 additions and 2537 deletions

3
.eslintignore Normal file
View File

@@ -0,0 +1,3 @@
/dist/**
/coverage/**
/node_modules/**

View File

@@ -1,11 +1,12 @@
{ {
"env": { "env": {
"node": true, "node": true,
"es2021": true, "es6": true,
"jest/globals": true "jest": true
}, },
"extends": [ "extends": [
"eslint:recommended", "eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
"plugin:jest/recommended", "plugin:jest/recommended",
"plugin:prettier/recommended" "plugin:prettier/recommended"

1
.github/CODEOWNERS vendored
View File

@@ -1 +0,0 @@
* @crazy-max

View File

@@ -11,6 +11,7 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: "daily"
versioning-strategy: "increase"
allow: allow:
- dependency-type: "production" - dependency-type: "production"
labels: labels:

View File

@@ -1,8 +1,12 @@
name: ci name: ci
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: on:
schedule: schedule:
- cron: '0 */4 * * *' # every 4 hours - cron: '0 10 * * *'
push: push:
branches: branches:
- 'master' - 'master'
@@ -10,9 +14,6 @@ on:
tags: tags:
- 'v*.*.*' - 'v*.*.*'
pull_request: pull_request:
branches:
- 'master'
- 'releases/v*'
env: env:
DOCKER_IMAGE: localhost:5000/name/app DOCKER_IMAGE: localhost:5000/name/app
@@ -23,7 +24,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
uses: ./ uses: ./
@@ -37,6 +38,9 @@ jobs:
type=ref,event=tag type=ref,event=tag
type=ref,event=pr type=ref,event=pr
type=sha type=sha
-
name: Print envs
run: env|sort
tag-schedule: tag-schedule:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -51,7 +55,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
uses: ./ uses: ./
@@ -81,7 +85,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
uses: ./ uses: ./
@@ -109,7 +113,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
uses: ./ uses: ./
@@ -134,7 +138,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
uses: ./ uses: ./
@@ -151,7 +155,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
uses: ./ uses: ./
@@ -166,7 +170,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
uses: ./ uses: ./
@@ -185,7 +189,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
uses: ./ uses: ./
@@ -206,7 +210,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
id: meta id: meta
@@ -235,7 +239,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
id: docker_meta id: docker_meta
@@ -254,15 +258,15 @@ jobs:
type=sha type=sha
- -
name: Set up QEMU name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v2
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v2
with: with:
driver-opts: network=host driver-opts: network=host
- -
name: Build and push to local registry name: Build and push to local registry
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
context: ./test context: ./test
file: ./test/Dockerfile file: ./test/Dockerfile
@@ -282,14 +286,14 @@ jobs:
- -
name: Dump context name: Dump context
if: always() if: always()
uses: crazy-max/ghaction-dump-context@v1 uses: crazy-max/ghaction-dump-context@v2
bake: bake:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- -
name: Docker meta name: Docker meta
id: docker_meta id: docker_meta
@@ -309,16 +313,72 @@ jobs:
type=sha type=sha
- -
name: Set up QEMU name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v2
- -
name: Set up Docker Buildx name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v2
- -
name: Build name: Build
uses: docker/bake-action@v1 uses: docker/bake-action@v3
with: with:
files: | files: |
./test/docker-bake.hcl ./test/docker-bake.hcl
${{ steps.docker_meta.outputs.bake-file }} ${{ steps.docker_meta.outputs.bake-file }}
targets: | targets: |
release release
sep-tags:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sep:
- " "
- ","
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
uses: ./
with:
images: |
${{ env.DOCKER_IMAGE }}
ghcr.io/name/app
sep-tags: ${{ matrix.sep }}
-
name: Tags
uses: actions/github-script@v6
with:
script: |
console.log(`${{ steps.meta.outputs.tags }}`);
output-env:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Docker meta
id: meta
uses: ./
with:
images: |
${{ env.DOCKER_IMAGE }}
ghcr.io/name/app
labels: |
maintainer=CrazyMax
-
name: Build
uses: docker/build-push-action@v4
with:
context: ./test
file: ./test/output.Dockerfile
build-args: |
DOCKER_METADATA_OUTPUT_VERSION
DOCKER_METADATA_OUTPUT_TAGS
DOCKER_METADATA_OUTPUT_LABELS
DOCKER_METADATA_OUTPUT_JSON

View File

@@ -1,14 +1,15 @@
name: test name: test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on: on:
push: push:
branches: branches:
- 'master' - 'master'
- 'releases/v*' - 'releases/v*'
pull_request: pull_request:
branches:
- 'master'
- 'releases/v*'
jobs: jobs:
test: test:
@@ -16,15 +17,10 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
-
name: Validate
uses: docker/bake-action@v1
with:
targets: validate
- -
name: Test name: Test
uses: docker/bake-action@v1 uses: docker/bake-action@v3
with: with:
targets: test targets: test
- -

45
.github/workflows/validate.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: validate
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- 'master'
- 'releases/v*'
pull_request:
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.targets.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Targets matrix
id: targets
run: |
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
validate:
runs-on: ubuntu-latest
needs:
- prepare
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Validate
uses: docker/bake-action@v3
with:
targets: ${{ matrix.target }}

229
README.md
View File

@@ -1,12 +1,14 @@
[![GitHub release](https://img.shields.io/github/release/docker/metadata-action.svg?style=flat-square)](https://github.com/docker/metadata-action/releases/latest) [![GitHub release](https://img.shields.io/github/release/docker/metadata-action.svg?style=flat-square)](https://github.com/docker/metadata-action/releases/latest)
[![GitHub marketplace](https://img.shields.io/badge/marketplace-docker--metadata--action-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/docker-metadata-action) [![GitHub marketplace](https://img.shields.io/badge/marketplace-docker--metadata--action-blue?logo=github&style=flat-square)](https://github.com/marketplace/actions/docker-metadata-action)
[![Test workflow](https://img.shields.io/github/workflow/status/docker/metadata-action/test?label=test&logo=github&style=flat-square)](https://github.com/docker/metadata-action/actions?workflow=test) [![CI workflow](https://img.shields.io/github/actions/workflow/status/docker/metadata-action/ci.yml?branch=master&label=ci&logo=github&style=flat-square)](https://github.com/docker/metadata-action/actions?workflow=ci)
[![Test workflow](https://img.shields.io/github/actions/workflow/status/docker/metadata-action/test.yml?branch=master&label=test&logo=github&style=flat-square)](https://github.com/docker/metadata-action/actions?workflow=test)
[![Codecov](https://img.shields.io/codecov/c/github/docker/metadata-action?logo=codecov&style=flat-square)](https://codecov.io/gh/docker/metadata-action) [![Codecov](https://img.shields.io/codecov/c/github/docker/metadata-action?logo=codecov&style=flat-square)](https://codecov.io/gh/docker/metadata-action)
## About ## About
GitHub Action to extract metadata from Git reference and GitHub events. GitHub Action to extract metadata from Git reference and GitHub events. This 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. is particularly useful if used with [Docker Build Push](https://github.com/docker/build-push-action)
action to tag and label Docker images.
![Screenshot](.github/metadata-action.png) ![Screenshot](.github/metadata-action.png)
@@ -19,6 +21,8 @@ ___
* [Customizing](#customizing) * [Customizing](#customizing)
* [inputs](#inputs) * [inputs](#inputs)
* [outputs](#outputs) * [outputs](#outputs)
* [environment variables](#environment-variables)
* [`context` input](#context-input)
* [`images` input](#images-input) * [`images` input](#images-input)
* [`flavor` input](#flavor-input) * [`flavor` input](#flavor-input)
* [`tags` input](#tags-input) * [`tags` input](#tags-input)
@@ -33,17 +37,18 @@ ___
* [Notes](#notes) * [Notes](#notes)
* [Image name and tag sanitization](#image-name-and-tag-sanitization) * [Image name and tag sanitization](#image-name-and-tag-sanitization)
* [Latest tag](#latest-tag) * [Latest tag](#latest-tag)
* [`priority` attribute](#priority-attribute)
* [Global expressions](#global-expressions) * [Global expressions](#global-expressions)
* [`{{branch}}`](#branch) * [`{{branch}}`](#branch)
* [`{{tag}}`](#tag) * [`{{tag}}`](#tag)
* [`{{sha}}`](#sha) * [`{{sha}}`](#sha)
* [`{{base_ref}}`](#base_ref) * [`{{base_ref}}`](#base_ref)
* [`{{is_default_branch}}`](#is_default_branch) * [`{{is_default_branch}}`](#is_default_branch)
* [`{{date '<format>'}}`](#date-format) * [`{{date '<format>' tz='<timezone>'}}`](#date-format-tztimezone)
* [Major version zero](#major-version-zero) * [Major version zero](#major-version-zero)
* [JSON output object](#json-output-object) * [JSON output object](#json-output-object)
* [Overwrite labels](#overwrite-labels) * [Overwrite labels](#overwrite-labels)
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot) * [Contributing](#contributing)
## Usage ## Usage
@@ -53,6 +58,7 @@ ___
name: ci name: ci
on: on:
workflow_dispatch:
push: push:
branches: branches:
- 'master' - 'master'
@@ -68,7 +74,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Docker meta name: Docker meta
id: meta id: meta
@@ -78,13 +84,13 @@ jobs:
- -
name: Login to DockerHub name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
name: Build and push name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
@@ -93,12 +99,13 @@ jobs:
``` ```
| Event | Ref | Docker Tags | | Event | Ref | Docker Tags |
|-----------------|-------------------------------|-------------------------------------| |---------------------|-------------------------------|----------------------------|
| `pull_request` | `refs/pull/2/merge` | `pr-2` | | `pull_request` | `refs/pull/2/merge` | `pr-2` |
| `push` | `refs/heads/master` | `master` | | `push` | `refs/heads/master` | `master` |
| `push` | `refs/heads/releases/v1` | `releases-v1` | | `push` | `refs/heads/releases/v1` | `releases-v1` |
| `push tag` | `refs/tags/v1.2.3` | `v1.2.3`, `latest` | | `push tag` | `refs/tags/v1.2.3` | `v1.2.3`, `latest` |
| `push tag` | `refs/tags/v2.0.8-beta.67` | `v2.0.8-beta.67`, `latest` | | `push tag` | `refs/tags/v2.0.8-beta.67` | `v2.0.8-beta.67`, `latest` |
| `workflow_dispatch` | `refs/heads/master` | `master` |
### Semver ### Semver
@@ -121,7 +128,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Docker meta name: Docker meta
id: meta id: meta
@@ -137,13 +144,13 @@ jobs:
- -
name: Login to DockerHub name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
name: Build and push name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
@@ -162,8 +169,8 @@ jobs:
### Bake definition ### Bake definition
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
`docker-metadata-action` and inherit from it. declare an empty target named `docker-metadata-action` and inherit from it.
```hcl ```hcl
// docker-bake.hcl // docker-bake.hcl
@@ -199,7 +206,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Docker meta name: Docker meta
id: meta id: meta
@@ -215,7 +222,7 @@ jobs:
type=sha type=sha
- -
name: Build name: Build
uses: docker/bake-action@v1 uses: docker/bake-action@v2
with: with:
files: | files: |
./docker-bake.hcl ./docker-bake.hcl
@@ -223,7 +230,8 @@ jobs:
targets: build targets: build
``` ```
Content of `${{ steps.meta.outputs.bake-file }}` file will look like this with `refs/tags/v1.2.3` ref: Content of `${{ steps.meta.outputs.bake-file }}` file will look like this with
`refs/tags/v1.2.3` ref:
```json ```json
{ {
@@ -269,7 +277,8 @@ Following inputs can be used as `step.with` keys
> ``` > ```
| Name | Type | Description | | Name | Type | Description |
|---------------------|--------|----------------------------------------------------------| |---------------------|--------|-------------------------------------------------------------------------------|
| `context` | String | Where to get context data. Allowed options are: `workflow` (default), `git`. |
| `images` | List | List of Docker images to use as base name for tags | | `images` | List | List of Docker images to use as base name for tags |
| `tags` | List | List of [tags](#tags-input) as key-value pair attributes | | `tags` | List | List of [tags](#tags-input) as key-value pair attributes |
| `flavor` | List | [Flavor](#flavor-input) to apply | | `flavor` | List | [Flavor](#flavor-input) to apply |
@@ -283,12 +292,49 @@ Following inputs can be used as `step.with` keys
Following outputs are available Following outputs are available
| Name | Type | Description | | Name | Type | Description |
|---------------|---------|-------------------------------------------------------------------------------| |---------------|---------|--------------------------------------------------------------------------------------------|
| `version` | String | Docker image version | | `version` | String | Docker image version |
| `tags` | String | Docker tags | | `tags` | String | Docker tags |
| `labels` | String | Docker labels | | `labels` | String | Docker labels |
| `json` | String | JSON output of tags and labels | | `json` | String | JSON output of tags and labels |
| `bake-file` | File | [Bake definition file](https://github.com/docker/buildx#file-definition) path | | `bake-file` | File | [Bake file definition](https://docs.docker.com/build/bake/reference/) path |
Alternatively, each output is also exported as an environment variable:
* `DOCKER_METADATA_OUTPUT_VERSION`
* `DOCKER_METADATA_OUTPUT_TAGS`
* `DOCKER_METADATA_OUTPUT_LABELS`
* `DOCKER_METADATA_OUTPUT_JSON`
* `DOCKER_METADATA_OUTPUT_BAKE_FILE`
So it can be used with our [Docker Build Push action](https://github.com/docker/build-push-action/):
```yaml
- uses: docker/build-push-action@v4
with:
build-args: |
DOCKER_METADATA_OUTPUT_JSON
```
### environment variables
| Name | Type | Description |
|-------------------------------|------|------------------------------------------------------------------------------------------------------------|
| `DOCKER_METADATA_PR_HEAD_SHA` | Bool | If `true`, set associated head SHA instead of commit SHA that triggered the workflow on pull request event |
## `context` input
`context` defines where to get context metadata:
```yaml
# default
context: workflow
# or
context: git
```
* `workflow`: Get context metadata from the workflow (GitHub context). See https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
* `git`: Get context metadata from the workflow and overrides some of them with current Git context, such as `ref` and `sha`.
## `images` input ## `images` input
@@ -325,13 +371,16 @@ flavor: |
``` ```
* `latest=<auto|true|false>`: Handle [latest tag](#latest-tag) (default `auto`) * `latest=<auto|true|false>`: Handle [latest tag](#latest-tag) (default `auto`)
* `prefix=<string>,onlatest=<true|false>`: A global prefix for each generated tag and optionally for `latest` * `prefix=<string>,onlatest=<true|false>`: A global prefix for each generated
* `suffix=<string>,onlatest=<true|false>`: A global suffix for each generated tag and optionally for `latest` tag and optionally for `latest`
* `suffix=<string>,onlatest=<true|false>`: A global suffix for each generated
tag and optionally for `latest`
## `tags` input ## `tags` input
`tags` is the core input of this action as everything related to it will reflect the output metadata. This one is in `tags` is the core input of this action as everything related to it will
the form of a key-value pair list in CSV format to remove limitations intrinsically linked to GitHub Actions reflect the output metadata. This one is in the form of a key-value pair list
in CSV format to remove limitations intrinsically linked to GitHub Actions
(only string format is handled in the input fields). Here is an example: (only string format is handled in the input fields). Here is an example:
```yaml ```yaml
@@ -359,7 +408,7 @@ Each entry is defined by a `type`, which are:
And global attributes: And global attributes:
* `enable=<true|false>` enable this entry (default `true`) * `enable=<true|false>` enable this entry (default `true`)
* `priority=<number>` priority to manage the order of tags * `priority=<number>` set tag [priority](#priority-attribute) order
* `prefix=<string>` add prefix * `prefix=<string>` add prefix
* `suffix=<string>` add suffix * `suffix=<string>` add suffix
@@ -383,18 +432,23 @@ tags: |
type=schedule,pattern=nightly type=schedule,pattern=nightly
# handlebars # handlebars
type=schedule,pattern={{date 'YYYYMMDD'}} type=schedule,pattern={{date 'YYYYMMDD'}}
# handlebars with timezone
type=schedule,pattern={{date 'YYYYMMDD-hhmmss' tz='Asia/Tokyo'}}
``` ```
Will be used on [schedule event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#schedule). Will be used on [schedule event](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule).
`pattern` is a specially crafted attribute to support [Handlebars' template](https://handlebarsjs.com/guide/) with `pattern` is a specially crafted attribute to support [Handlebars' template](https://handlebarsjs.com/guide/)
the following expressions: with the following expressions:
* `date 'format'` ; render date by its [moment format](https://momentjs.com/docs/#/displaying/format/)
* `date 'format' tz='Timezone'` ; render date by its [moment format](https://momentjs.com/docs/#/displaying/format/).
Default `tz` is UTC.
| Pattern | Output | | Pattern | Output |
|--------------------------|----------------------| |----------------------------------------------|-------------------|
| `nightly` | `nightly` | | `nightly` | `nightly` |
| `{{date 'YYYYMMDD'}}` | `20210326` | | `{{date 'YYYYMMDD'}}` | `20200110` |
| `{{date 'YYYYMMDD-HHmmss' tz='Asia/Tokyo'}}` | `20200110-093000` |
Extended attributes and default values: Extended attributes and default values:
@@ -413,11 +467,13 @@ tags: |
type=semver,pattern={{version}},value=v1.0.0 type=semver,pattern={{version}},value=v1.0.0
``` ```
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push) Will be used on a [push tag event](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push)
and requires a valid [semver](https://semver.org/) Git tag, but you can also use a custom value through `value` and requires a valid [semver](https://semver.org/) Git tag, but you can also
attribute. use a custom value through `value` attribute.
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/)
with the following expressions:
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
* `raw` ; the actual tag * `raw` ; the actual tag
* `version` ; shorthand for `{{major}}.{{minor}}.{{patch}}` (can include pre-release) * `version` ; shorthand for `{{major}}.{{minor}}.{{patch}}` (can include pre-release)
* `major` ; major version identifier * `major` ; major version identifier
@@ -436,9 +492,10 @@ attribute.
| `v2.0.8-beta.67` | `{{version}}` | `2.0.8-beta.67` | | `v2.0.8-beta.67` | `{{version}}` | `2.0.8-beta.67` |
| `v2.0.8-beta.67` | `{{major}}.{{minor}}` | `2.0.8-beta.67`* | | `v2.0.8-beta.67` | `{{major}}.{{minor}}` | `2.0.8-beta.67`* |
> *Pre-release (rc, beta, alpha) will only extend `{{version}}` (or `{{raw}}` if specified) as tag > *Pre-release (rc, beta, alpha) will only extend `{{version}}` (or `{{raw}}`
> because they are updated frequently, and contain many breaking changes that are (by the author's design) > if specified) as tag because they are updated frequently, and contain many
> not yet fit for public consumption. > breaking changes that are (by the author's design) not yet fit for public
> consumption.
Extended attributes and default values: Extended attributes and default values:
@@ -457,11 +514,13 @@ tags: |
type=pep440,pattern={{version}},value=1.0.0 type=pep440,pattern={{version}},value=1.0.0
``` ```
Will be used on a [push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push) Will be used on a [push tag event](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push)
and requires a Git tag that conforms to [PEP 440](https://www.python.org/dev/peps/pep-0440/), but you can also use a and requires a Git tag that conforms to [PEP 440](https://www.python.org/dev/peps/pep-0440/),
custom value through `value` attribute. but you can also use a custom value through `value` attribute.
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/)
with the following expressions:
`pattern` attribute supports [Handlebars template](https://handlebarsjs.com/guide/) with the following expressions:
* `raw` ; the actual tag * `raw` ; the actual tag
* `version` ; cleaned version * `version` ; cleaned version
* `major` ; major version identifier * `major` ; major version identifier
@@ -482,9 +541,10 @@ custom value through `value` attribute.
| `1.2.3beta2` | `{{major}}.{{minor}}` | `1.2.3b2`* | | `1.2.3beta2` | `{{major}}.{{minor}}` | `1.2.3b2`* |
| `1.0dev4` | `{{major}}.{{minor}}` | `1.0.dev4`* | | `1.0dev4` | `{{major}}.{{minor}}` | `1.0.dev4`* |
> *dev/pre/post release will only extend `{{version}}` (or `{{raw}}` if specified) as tag > *dev/pre/post release will only extend `{{version}}` (or `{{raw}}` if
> because they are updated frequently, and contain many breaking changes that are (by the author's design) > specified) as tag because they are updated frequently, and contain many
> not yet fit for public consumption. > breaking changes that are (by the author's design) not yet fit for public
> consumption.
Extended attributes and default values: Extended attributes and default values:
@@ -505,9 +565,9 @@ tags: |
type=match,pattern=v(.*),group=1,value=v1.0.0 type=match,pattern=v(.*),group=1,value=v1.0.0
``` ```
Can create a regular expression for matching Git tag with a pattern and capturing group. Will be used on a Can create a regular expression for matching Git tag with a pattern and
[push tag event](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#push) but, you can also use capturing group. Will be used on a [push tag event](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push)
a custom value through `value` attribute. but, you can also use a custom value through `value` attribute.
| Git tag | Pattern | Group | Output | | Git tag | Pattern | Group | Output |
|-------------------------|------------------|---------|------------------------| |-------------------------|------------------|---------|------------------------|
@@ -534,9 +594,9 @@ tags: |
type=edge,branch=main type=edge,branch=main
``` ```
An `edge` tag reflects the last commit of the active branch on your Git repository. I usually prefer to use `edge` An `edge` tag reflects the last commit of the active branch on your Git
as a Docker tag for a better distinction or common pattern. This is also used by official images repository. I usually prefer to use `edge` as a Docker tag for a better
like [Alpine](https://hub.docker.com/_/alpine). distinction or common pattern. This is also used by official images like [Alpine](https://hub.docker.com/_/alpine).
Extended attributes and default values: Extended attributes and default values:
@@ -558,17 +618,19 @@ tags: |
``` ```
This type handles Git ref (or reference) for the following events: This type handles Git ref (or reference) for the following events:
* `branch` ; eg. `refs/heads/master` * `branch` ; eg. `refs/heads/master`
* `tag` ; eg. `refs/tags/v1.0.0` * `tag` ; eg. `refs/tags/v1.0.0`
* `pr` ; eg. `refs/pull/318/merge` * `pr` ; eg. `refs/pull/318/merge`
| Event | Ref | Output | | Event | Ref | Output |
|-----------------|-------------------------------|-------------------------------| |---------------------|-------------------------------|------------------|
| `pull_request` | `refs/pull/2/merge` | `pr-2` | | `pull_request` | `refs/pull/2/merge` | `pr-2` |
| `push` | `refs/heads/master` | `master` | | `push` | `refs/heads/master` | `master` |
| `push` | `refs/heads/my/branch` | `my-branch` | | `push` | `refs/heads/my/branch` | `my-branch` |
| `push tag` | `refs/tags/v1.2.3` | `v1.2.3` | | `push tag` | `refs/tags/v1.2.3` | `v1.2.3` |
| `push tag` | `refs/tags/v2.0.8-beta.67` | `v2.0.8-beta.67` | | `push tag` | `refs/tags/v2.0.8-beta.67` | `v2.0.8-beta.67` |
| `workflow_dispatch` | `refs/heads/master` | `master` |
Extended attributes and default values: Extended attributes and default values:
@@ -628,7 +690,7 @@ tags: |
### Image name and tag sanitization ### Image name and tag sanitization
In order to comply with [the specification](https://docs.docker.com/engine/reference/commandline/tag/#extended-description), In order to comply with [the specification](https://docs.docker.com/engine/reference/commandline/tag/#description),
the image name components may contain lowercase letters, digits and separators. the image name components may contain lowercase letters, digits and separators.
A separator is defined as a period, one or two underscores, or one or more A separator is defined as a period, one or two underscores, or one or more
dashes. A name component may not start or end with a separator. dashes. A name component may not start or end with a separator.
@@ -644,7 +706,9 @@ To ease the integration in your workflow, this action will automatically:
### Latest tag ### Latest tag
`latest` tag is handled through the [`flavor` input](#flavor-input). It will be generated by default (`auto` mode) for: `latest` tag is handled through the [`flavor` input](#flavor-input). It will be
generated by default (`auto` mode) for:
* [`type=ref,event=tag`](#typeref) * [`type=ref,event=tag`](#typeref)
* [`type=semver,pattern=...`](#typesemver) * [`type=semver,pattern=...`](#typesemver)
* [`type=match,pattern=...`](#typematch) * [`type=match,pattern=...`](#typematch)
@@ -667,6 +731,24 @@ tags: |
type=raw,value=latest,enable={{is_default_branch}} type=raw,value=latest,enable={{is_default_branch}}
``` ```
### `priority` attribute
`priority=<int>` attribute is used to sort tags in the final list. The higher
the value, the higher the priority. The first tag in the list (higher priority)
will be used as the image version for generated OCI label and [`version` output](#outputs).
Each tags `type` attribute has a default priority:
| Attribute | Default priority |
|------------|------------------|
| `schedule` | `1000` |
| `semver` | `900` |
| `pep440` | `900` |
| `match` | `800` |
| `edge` | `700` |
| `ref` | `600` |
| `raw` | `200` |
| `sha` | `100` |
### Global expressions ### Global expressions
The following [Handlebars' template](https://handlebarsjs.com/guide/) expressions The following [Handlebars' template](https://handlebarsjs.com/guide/) expressions
@@ -686,7 +768,7 @@ Returns the branch name that triggered the workflow run. Will be empty if not
a branch reference: a branch reference:
| Event | Ref | Output | | Event | Ref | Output |
|-----------------|-------------------------------|---------------------| |----------------|------------------------|-------------|
| `pull_request` | `refs/pull/2/merge` | | | `pull_request` | `refs/pull/2/merge` | |
| `push` | `refs/heads/master` | `master` | | `push` | `refs/heads/master` | `master` |
| `push` | `refs/heads/my/branch` | `my-branch` | | `push` | `refs/heads/my/branch` | `my-branch` |
@@ -731,22 +813,24 @@ workflow run. Will be empty for a branch reference:
Returns `true` if the branch that triggered the workflow run is the default Returns `true` if the branch that triggered the workflow run is the default
one, otherwise `false`. one, otherwise `false`.
#### `{{date '<format>'}}` #### `{{date '<format>' tz='<timezone>'}}`
Returns the current date rendered by its [moment format](https://momentjs.com/docs/#/displaying/format/). Returns the current date rendered by its [moment format](https://momentjs.com/docs/#/displaying/format/).
Default `tz` is UTC.
| Expression | Output example | | Expression | Output example |
|--------------------------------------------|-----------------------------------------| |----------------------------------------------|-----------------------------------------|
| `{{date 'YYYYMMDD'}}` | `20200110` | | `{{date 'YYYYMMDD'}}` | `20200110` |
| `{{date 'dddd, MMMM Do YYYY, h:mm:ss a'}}` | `Friday, January 10th 2020, 3:25:50 pm` | | `{{date 'dddd, MMMM Do YYYY, h:mm:ss a'}}` | `Friday, January 10th 2020, 3:25:50 pm` |
| `{{date 'YYYYMMDD-HHmmss' tz='Asia/Tokyo'}}` | `20200110-093000` |
### Major version zero ### Major version zero
Major version zero (`0.y.z`) is for initial development and **may** change at any time. This means the public API Major version zero (`0.y.z`) is for initial development and **may** change at
[**should not** be considered stable](https://semver.org/#spec-item-4). any time. This means the public API [**should not** be considered stable](https://semver.org/#spec-item-4).
In this case, Docker tag `0` **should not** be generated if you're using [`type=semver`](#typesemver) with `{{major}}` In this case, Docker tag `0` **should not** be generated if you're using [`type=semver`](#typesemver)
pattern. You can manage this behavior like this: with `{{major}}` pattern. You can manage this behavior like this:
```yaml ```yaml
# refs/tags/v0.1.2 # refs/tags/v0.1.2
@@ -761,8 +845,8 @@ tags: |
### JSON output object ### JSON output object
The `json` output is a JSON object composed of the generated tags and labels so that you can reuse them further in your The `json` output is a JSON object composed of the generated tags and labels so
workflow using the [`fromJSON` function](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson): that you can reuse them further in your workflow using the [`fromJSON` function](https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson):
```yaml ```yaml
- -
@@ -773,7 +857,7 @@ workflow using the [`fromJSON` function](https://docs.github.com/en/actions/lear
images: name/app images: name/app
- -
name: Build and push name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
@@ -802,18 +886,7 @@ labels generated are not suitable, you can overwrite them like this:
org.opencontainers.image.vendor=MyCompany org.opencontainers.image.vendor=MyCompany
``` ```
## Keep up-to-date with GitHub Dependabot ## Contributing
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot) Want to contribute? Awesome! You can find information about contributing to
has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem), this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:
```yaml
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
```

View File

@@ -2,7 +2,8 @@
## v2 to v3 ## v2 to v3
* Repository has been moved to docker org. Replace `crazy-max/ghaction-docker-meta@v2` with `docker/metadata-action@v4` * Repository has been moved to docker org. Replace `crazy-max/ghaction-docker-meta@v2`
with `docker/metadata-action@v4`
* The default bake target has been changed: `ghaction-docker-meta` > `docker-metadata-action` * The default bake target has been changed: `ghaction-docker-meta` > `docker-metadata-action`
## v1 to v2 ## v1 to v2
@@ -132,7 +133,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Docker meta name: Docker meta
id: meta id: meta
@@ -142,13 +143,13 @@ jobs:
- -
name: Login to DockerHub name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
name: Build and push name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
@@ -176,7 +177,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Docker meta name: Docker meta
id: meta id: meta
@@ -186,13 +187,13 @@ jobs:
- -
name: Login to DockerHub name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
name: Build and push name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
@@ -222,7 +223,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Docker meta name: Docker meta
id: meta id: meta
@@ -235,13 +236,13 @@ jobs:
- -
name: Login to DockerHub name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
name: Build and push name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}
@@ -269,7 +270,7 @@ jobs:
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v3
- -
name: Docker meta name: Docker meta
id: meta id: meta
@@ -284,13 +285,13 @@ jobs:
- -
name: Login to DockerHub name: Login to DockerHub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- -
name: Build and push name: Build and push
uses: docker/build-push-action@v2 uses: docker/build-push-action@v4
with: with:
context: . context: .
push: ${{ github.event_name != 'pull_request' }} push: ${{ github.event_name != 'pull_request' }}

View File

@@ -0,0 +1,207 @@
import {jest} from '@jest/globals';
export const context = {
repo: {
owner: 'docker',
repo: 'actions-toolkit'
},
ref: 'refs/heads/master',
runId: 123,
payload: {
after: '860c1904a1ce19322e91ac35af1ab07466440c37',
base_ref: null,
before: '5f3331d7f7044c18ca9f12c77d961c4d7cf3276a',
commits: [
{
author: {
email: 'crazy-max@users.noreply.github.com',
name: 'CrazyMax',
username: 'crazy-max'
},
committer: {
email: 'crazy-max@users.noreply.github.com',
name: 'CrazyMax',
username: 'crazy-max'
},
distinct: true,
id: '860c1904a1ce19322e91ac35af1ab07466440c37',
message: 'hello dev',
timestamp: '2022-04-19T11:27:24+02:00',
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
}
],
compare: 'https://github.com/docker/test-docker-action/compare/5f3331d7f704...860c1904a1ce',
created: false,
deleted: false,
forced: false,
head_commit: {
author: {
email: 'crazy-max@users.noreply.github.com',
name: 'CrazyMax',
username: 'crazy-max'
},
committer: {
email: 'crazy-max@users.noreply.github.com',
name: 'CrazyMax',
username: 'crazy-max'
},
distinct: true,
id: '860c1904a1ce19322e91ac35af1ab07466440c37',
message: 'hello dev',
timestamp: '2022-04-19T11:27:24+02:00',
tree_id: 'd2c60af597e863787d2d27f569e30495b0b92820',
url: 'https://github.com/docker/test-docker-action/commit/860c1904a1ce19322e91ac35af1ab07466440c37'
},
organization: {
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
description: 'Docker helps developers bring their ideas to life by conquering the complexity of app development.',
events_url: 'https://api.github.com/orgs/docker/events',
hooks_url: 'https://api.github.com/orgs/docker/hooks',
id: 5429470,
issues_url: 'https://api.github.com/orgs/docker/issues',
login: 'docker',
members_url: 'https://api.github.com/orgs/docker/members{/member}',
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
public_members_url: 'https://api.github.com/orgs/docker/public_members{/member}',
repos_url: 'https://api.github.com/orgs/docker/repos',
url: 'https://api.github.com/orgs/docker'
},
pusher: {
email: 'github@crazymax.dev',
name: 'crazy-max'
},
ref: 'refs/heads/dev',
repository: {
allow_forking: true,
archive_url: 'https://api.github.com/repos/docker/test-docker-action/{archive_format}{/ref}',
archived: false,
assignees_url: 'https://api.github.com/repos/docker/test-docker-action/assignees{/user}',
blobs_url: 'https://api.github.com/repos/docker/test-docker-action/git/blobs{/sha}',
branches_url: 'https://api.github.com/repos/docker/test-docker-action/branches{/branch}',
clone_url: 'https://github.com/docker/test-docker-action.git',
collaborators_url: 'https://api.github.com/repos/docker/test-docker-action/collaborators{/collaborator}',
comments_url: 'https://api.github.com/repos/docker/test-docker-action/comments{/number}',
commits_url: 'https://api.github.com/repos/docker/test-docker-action/commits{/sha}',
compare_url: 'https://api.github.com/repos/docker/test-docker-action/compare/{base}...{head}',
contents_url: 'https://api.github.com/repos/docker/test-docker-action/contents/{+path}',
contributors_url: 'https://api.github.com/repos/docker/test-docker-action/contributors',
created_at: 1596792180,
default_branch: 'master',
deployments_url: 'https://api.github.com/repos/docker/test-docker-action/deployments',
description: 'Test "Docker" Actions',
disabled: false,
downloads_url: 'https://api.github.com/repos/docker/test-docker-action/downloads',
events_url: 'https://api.github.com/repos/docker/test-docker-action/events',
fork: false,
forks: 1,
forks_count: 1,
forks_url: 'https://api.github.com/repos/docker/test-docker-action/forks',
full_name: 'docker/test-docker-action',
git_commits_url: 'https://api.github.com/repos/docker/test-docker-action/git/commits{/sha}',
git_refs_url: 'https://api.github.com/repos/docker/test-docker-action/git/refs{/sha}',
git_tags_url: 'https://api.github.com/repos/docker/test-docker-action/git/tags{/sha}',
git_url: 'git://github.com/docker/test-docker-action.git',
has_downloads: true,
has_issues: true,
has_pages: false,
has_projects: true,
has_wiki: true,
homepage: '',
hooks_url: 'https://api.github.com/repos/docker/test-docker-action/hooks',
html_url: 'https://github.com/docker/test-docker-action',
id: 285789493,
is_template: false,
issue_comment_url: 'https://api.github.com/repos/docker/test-docker-action/issues/comments{/number}',
issue_events_url: 'https://api.github.com/repos/docker/test-docker-action/issues/events{/number}',
issues_url: 'https://api.github.com/repos/docker/test-docker-action/issues{/number}',
keys_url: 'https://api.github.com/repos/docker/test-docker-action/keys{/key_id}',
labels_url: 'https://api.github.com/repos/docker/test-docker-action/labels{/name}',
language: 'JavaScript',
languages_url: 'https://api.github.com/repos/docker/test-docker-action/languages',
license: {
key: 'mit',
name: 'MIT License',
node_id: 'MDc6TGljZW5zZTEz',
spdx_id: 'MIT',
url: 'https://api.github.com/licenses/mit'
},
master_branch: 'master',
merges_url: 'https://api.github.com/repos/docker/test-docker-action/merges',
milestones_url: 'https://api.github.com/repos/docker/test-docker-action/milestones{/number}',
mirror_url: null,
name: 'test-docker-action',
node_id: 'MDEwOlJlcG9zaXRvcnkyODU3ODk0OTM=',
notifications_url: 'https://api.github.com/repos/docker/test-docker-action/notifications{?since,all,participating}',
open_issues: 6,
open_issues_count: 6,
organization: 'docker',
owner: {
avatar_url: 'https://avatars.githubusercontent.com/u/5429470?v=4',
email: 'info@docker.com',
events_url: 'https://api.github.com/users/docker/events{/privacy}',
followers_url: 'https://api.github.com/users/docker/followers',
following_url: 'https://api.github.com/users/docker/following{/other_user}',
gists_url: 'https://api.github.com/users/docker/gists{/gist_id}',
gravatar_id: '',
html_url: 'https://github.com/docker',
id: 5429470,
login: 'docker',
name: 'docker',
node_id: 'MDEyOk9yZ2FuaXphdGlvbjU0Mjk0NzA=',
organizations_url: 'https://api.github.com/users/docker/orgs',
received_events_url: 'https://api.github.com/users/docker/received_events',
repos_url: 'https://api.github.com/users/docker/repos',
site_admin: false,
starred_url: 'https://api.github.com/users/docker/starred{/owner}{/repo}',
subscriptions_url: 'https://api.github.com/users/docker/subscriptions',
type: 'Organization',
url: 'https://api.github.com/users/docker'
},
private: true,
pulls_url: 'https://api.github.com/repos/docker/test-docker-action/pulls{/number}',
pushed_at: 1650360446,
releases_url: 'https://api.github.com/repos/docker/test-docker-action/releases{/id}',
size: 796,
ssh_url: 'git@github.com:docker/test-docker-action.git',
stargazers: 0,
stargazers_count: 0,
stargazers_url: 'https://api.github.com/repos/docker/test-docker-action/stargazers',
statuses_url: 'https://api.github.com/repos/docker/test-docker-action/statuses/{sha}',
subscribers_url: 'https://api.github.com/repos/docker/test-docker-action/subscribers',
subscription_url: 'https://api.github.com/repos/docker/test-docker-action/subscription',
svn_url: 'https://github.com/docker/test-docker-action',
tags_url: 'https://api.github.com/repos/docker/test-docker-action/tags',
teams_url: 'https://api.github.com/repos/docker/test-docker-action/teams',
topics: [],
trees_url: 'https://api.github.com/repos/docker/test-docker-action/git/trees{/sha}',
updated_at: '2022-04-19T09:05:09Z',
url: 'https://github.com/docker/test-docker-action',
visibility: 'private',
watchers: 0,
watchers_count: 0
},
sender: {
avatar_url: 'https://avatars.githubusercontent.com/u/1951866?v=4',
events_url: 'https://api.github.com/users/crazy-max/events{/privacy}',
followers_url: 'https://api.github.com/users/crazy-max/followers',
following_url: 'https://api.github.com/users/crazy-max/following{/other_user}',
gists_url: 'https://api.github.com/users/crazy-max/gists{/gist_id}',
gravatar_id: '',
html_url: 'https://github.com/crazy-max',
id: 1951866,
login: 'crazy-max',
node_id: 'MDQ6VXNlcjE5NTE4NjY=',
organizations_url: 'https://api.github.com/users/crazy-max/orgs',
received_events_url: 'https://api.github.com/users/crazy-max/received_events',
repos_url: 'https://api.github.com/users/crazy-max/repos',
site_admin: false,
starred_url: 'https://api.github.com/users/crazy-max/starred{/owner}{/repo}',
subscriptions_url: 'https://api.github.com/users/crazy-max/subscriptions',
type: 'User',
url: 'https://api.github.com/users/crazy-max'
}
}
};
export const getOctokit = jest.fn();

View File

@@ -1,192 +1,126 @@
import {beforeEach, describe, expect, it, jest} from '@jest/globals'; import {afterEach, beforeEach, describe, expect, test, it, jest} from '@jest/globals';
import * as dotenv from 'dotenv';
import * as fs from 'fs'; import * as fs from 'fs';
import * as os from 'os';
import * as path from 'path'; import * as path from 'path';
import {Context} from '@actions/github/lib/context';
import {Git} from '@docker/actions-toolkit/lib/git';
import {GitHub} from '@docker/actions-toolkit/lib/github';
import * as context from '../src/context'; import {ContextSource, getContext, getInputs, Inputs} from '../src/context';
jest.spyOn(context, 'tmpDir').mockImplementation((): string => { beforeEach(() => {
const tmpDir = path.join('/tmp/.docker-metadata-action-jest').split(path.sep).join(path.posix.sep); jest.clearAllMocks();
if (!fs.existsSync(tmpDir)) { jest.spyOn(GitHub, 'context', 'get').mockImplementation((): Context => {
fs.mkdirSync(tmpDir, {recursive: true}); return new Context();
}
return tmpDir;
});
describe('getInputList', () => {
it('single line correctly', async () => {
await setInput('foo', 'bar');
const res = context.getInputList('foo');
expect(res).toEqual(['bar']);
});
it('multiline correctly', async () => {
setInput('foo', 'bar\nbaz');
const res = context.getInputList('foo');
expect(res).toEqual(['bar', 'baz']);
});
it('empty lines correctly', async () => {
setInput('foo', 'bar\n\nbaz');
const res = context.getInputList('foo');
expect(res).toEqual(['bar', 'baz']);
});
it('comment correctly', async () => {
setInput('foo', 'bar\n#com\n"#taken"\nhello#comment\nbaz');
const res = context.getInputList('foo');
expect(res).toEqual(['bar', '#taken', 'hello', 'baz']);
});
it('comma correctly', async () => {
setInput('foo', 'bar,baz');
const res = context.getInputList('foo');
expect(res).toEqual(['bar', 'baz']);
});
it('empty result correctly', async () => {
setInput('foo', 'bar,baz,');
const res = context.getInputList('foo');
expect(res).toEqual(['bar', 'baz']);
});
it('different new lines correctly', async () => {
setInput('foo', 'bar\r\nbaz');
const res = context.getInputList('foo');
expect(res).toEqual(['bar', 'baz']);
});
it('different new lines and comma correctly', async () => {
setInput('foo', 'bar\r\nbaz,bat');
const res = context.getInputList('foo');
expect(res).toEqual(['bar', 'baz', 'bat']);
});
it('multiline and ignoring comma correctly', async () => {
setInput('cache-from', 'user/app:cache\ntype=local,src=path/to/dir');
const res = context.getInputList('cache-from', true);
expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']);
});
it('different new lines and ignoring comma correctly', async () => {
setInput('cache-from', 'user/app:cache\r\ntype=local,src=path/to/dir');
const res = context.getInputList('cache-from', true);
expect(res).toEqual(['user/app:cache', 'type=local,src=path/to/dir']);
});
it('multiline values', async () => {
setInput(
'secrets',
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
"MYSECRET=aaaaaaaa
bbbbbbb
ccccccccc"
FOO=bar`
);
const res = context.getInputList('secrets', true);
expect(res).toEqual([
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
`MYSECRET=aaaaaaaa
bbbbbbb
ccccccccc`,
'FOO=bar'
]);
});
it('multiline values with empty lines', async () => {
setInput(
'secrets',
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
"MYSECRET=aaaaaaaa
bbbbbbb
ccccccccc"
FOO=bar
"EMPTYLINE=aaaa
bbbb
ccc"`
);
const res = context.getInputList('secrets', true);
expect(res).toEqual([
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
`MYSECRET=aaaaaaaa
bbbbbbb
ccccccccc`,
'FOO=bar',
`EMPTYLINE=aaaa
bbbb
ccc`
]);
});
it('multiline values without quotes', async () => {
setInput(
'secrets',
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
MYSECRET=aaaaaaaa
bbbbbbb
ccccccccc
FOO=bar`
);
const res = context.getInputList('secrets', true);
expect(res).toEqual(['GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789', 'MYSECRET=aaaaaaaa', 'bbbbbbb', 'ccccccccc', 'FOO=bar']);
});
it('multiline values escape quotes', async () => {
setInput(
'secrets',
`GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789
"MYSECRET=aaaaaaaa
bbbb""bbb
ccccccccc"
FOO=bar`
);
const res = context.getInputList('secrets', true);
expect(res).toEqual([
'GIT_AUTH_TOKEN=abcdefgh,ijklmno=0123456789',
`MYSECRET=aaaaaaaa
bbbb"bbb
ccccccccc`,
'FOO=bar'
]);
}); });
}); });
describe('asyncForEach', () => { describe('getInputs', () => {
it('executes async tasks sequentially', async () => {
const testValues = [1, 2, 3, 4, 5];
const results: number[] = [];
await context.asyncForEach(testValues, async value => {
results.push(value);
});
expect(results).toEqual(testValues);
});
});
describe('setOutput', () => {
beforeEach(() => { beforeEach(() => {
process.stdout.write = jest.fn() as typeof process.stdout.write; process.env = Object.keys(process.env).reduce((object, key) => {
if (!key.startsWith('INPUT_')) {
object[key] = process.env[key];
}
return object;
}, {});
}); });
// eslint-disable-next-line jest/expect-expect // prettier-ignore
it('setOutput produces the correct command', () => { test.each([
context.setOutput('some output', 'some value'); [
assertWriteCalls([`::set-output name=some output::some value${os.EOL}`]); 0,
new Map<string, string>([
['images', 'moby/buildkit\nghcr.io/moby/mbuildkit'],
]),
{
context: ContextSource.workflow,
bakeTarget: 'docker-metadata-action',
flavor: [],
githubToken: '',
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
labels: [],
sepLabels: '\n',
sepTags: '\n',
tags: [],
} as Inputs
],
[
1,
new Map<string, string>([
['bake-target', 'metadata'],
['images', 'moby/buildkit'],
['sep-labels', ','],
['sep-tags', ','],
]),
{
context: ContextSource.workflow,
bakeTarget: 'metadata',
flavor: [],
githubToken: '',
images: ['moby/buildkit'],
labels: [],
sepLabels: ',',
sepTags: ',',
tags: [],
} as Inputs
],
[
2,
new Map<string, string>([
['images', 'moby/buildkit\n#comment\nghcr.io/moby/mbuildkit'],
]),
{
context: ContextSource.workflow,
bakeTarget: 'docker-metadata-action',
flavor: [],
githubToken: '',
images: ['moby/buildkit', 'ghcr.io/moby/mbuildkit'],
labels: [],
sepLabels: '\n',
sepTags: '\n',
tags: [],
} as Inputs
],
])(
'[%d] given %p as inputs, returns %p',
async (num: number, inputs: Map<string, string>, expected: Inputs) => {
inputs.forEach((value: string, name: string) => {
setInput(name, value);
});
expect(await getInputs()).toEqual(expected);
}
);
});
describe('getContext', () => {
const originalEnv = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {
...originalEnv,
...dotenv.parse(fs.readFileSync(path.join(__dirname, 'fixtures/event_create_branch.env')))
};
});
afterEach(() => {
process.env = originalEnv;
}); });
// eslint-disable-next-line jest/expect-expect it('workflow', async () => {
it('setOutput handles bools', () => { const context = await getContext(ContextSource.workflow);
context.setOutput('some output', false); expect(context.ref).toEqual('refs/heads/dev');
assertWriteCalls([`::set-output name=some output::false${os.EOL}`]); expect(context.sha).toEqual('5f3331d7f7044c18ca9f12c77d961c4d7cf3276a');
}); });
// eslint-disable-next-line jest/expect-expect it('git', async () => {
it('setOutput handles numbers', () => { jest.spyOn(Git, 'context').mockImplementation((): Promise<Context> => {
context.setOutput('some output', 1.01); return Promise.resolve({
assertWriteCalls([`::set-output name=some output::1.01${os.EOL}`]); ref: 'refs/heads/git-test',
sha: 'git-test-sha'
} as Context);
});
const context = await getContext(ContextSource.git);
expect(context.ref).toEqual('refs/heads/git-test');
expect(context.sha).toEqual('git-test-sha');
}); });
}); });
@@ -198,11 +132,3 @@ function getInputName(name: string): string {
function setInput(name: string, value: string): void { function setInput(name: string, value: string): void {
process.env[getInputName(name)] = value; process.env[getInputName(name)] = value;
} }
// Assert that process.stdout.write calls called only with the given arguments.
function assertWriteCalls(calls: string[]): void {
expect(process.stdout.write).toHaveBeenCalledTimes(calls.length);
for (let i = 0; i < calls.length; i++) {
expect(process.stdout.write).toHaveBeenNthCalledWith(i + 1, calls[i]);
}
}

View File

@@ -1,4 +1,5 @@
import {describe, expect, test} from '@jest/globals'; import {describe, expect, test} from '@jest/globals';
import {Flavor, Transform} from '../src/flavor'; import {Flavor, Transform} from '../src/flavor';
describe('transform', () => { describe('transform', () => {

View File

@@ -1,14 +0,0 @@
import {describe, expect, jest, it} from '@jest/globals';
import * as github from '../src/github';
import * as repoFixture from './fixtures/repo.json';
jest.spyOn(github, 'repo').mockImplementation((): Promise<github.ReposGetResponseData> => {
return <Promise<github.ReposGetResponseData>>(repoFixture as unknown);
});
describe('repo', () => {
it('returns GitHub repository', async () => {
const repo = await github.repo(process.env.GITHUB_TOKEN || '');
expect(repo.name).not.toBeNull();
});
});

View File

@@ -1,4 +1,5 @@
import {describe, expect, test} from '@jest/globals'; import {describe, expect, test} from '@jest/globals';
import {Transform, Image} from '../src/image'; import {Transform, Image} from '../src/image';
describe('transform', () => { describe('transform', () => {
@@ -86,7 +87,7 @@ describe('transform', () => {
[ [
[`name/foo,name=name/bar,enable=true`], undefined, true [`name/foo,name=name/bar,enable=true`], undefined, true
] ]
])('given %p', async (l: string[], expected: Image[], invalid: boolean) => { ])('given %p', async (l: string[], expected: Image[] | undefined, invalid: boolean) => {
try { try {
const images = Transform(l); const images = Transform(l);
expect(images).toEqual(expected); expect(images).toEqual(expected);

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
import {describe, expect, test} from '@jest/globals'; import {describe, expect, test} from '@jest/globals';
import {Transform, Parse, Tag, Type, RefEvent, ShaFormat, DefaultPriorities} from '../src/tag'; import {Transform, Parse, Tag, Type, RefEvent, ShaFormat, DefaultPriorities} from '../src/tag';
describe('transform', () => { describe('transform', () => {
@@ -126,6 +127,18 @@ describe('parse', () => {
} as Tag, } as Tag,
false false
], ],
[
`type=schedule,enable=true,pattern={{date 'YYYYMMDD' tz='Asia/Tokyo'}}`,
{
type: Type.Schedule,
attrs: {
"priority": DefaultPriorities[Type.Schedule],
"enable": "true",
"pattern": `{{date 'YYYYMMDD' tz='Asia/Tokyo'}}`
}
} as Tag,
false
],
[ [
`type=semver,enable=true,pattern={{version}}`, `type=semver,enable=true,pattern={{version}}`,
{ {

View File

@@ -7,6 +7,10 @@ branding:
color: 'blue' color: 'blue'
inputs: inputs:
context:
description: 'Where to get context data. Allowed options are "workflow" (default), "git".'
default: "workflow"
required: true
images: images:
description: 'List of Docker images to use as base name for tags' description: 'List of Docker images to use as base name for tags'
required: true required: true
@@ -46,5 +50,5 @@ outputs:
description: 'JSON output of tags and labels' description: 'JSON output of tags and labels'
runs: runs:
using: 'node16' using: 'node20'
main: 'dist/index.js' main: 'dist/index.js'

View File

@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
ARG NODE_VERSION=16 ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-alpine AS base FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git RUN apk add --no-cache cpio findutils git
@@ -16,14 +16,14 @@ COPY --from=deps /vendor /
FROM deps AS vendor-validate FROM deps AS vendor-validate
RUN --mount=type=bind,target=.,rw <<EOT RUN --mount=type=bind,target=.,rw <<EOT
set -e set -e
git add -A git add -A
cp -rf /vendor/* . cp -rf /vendor/* .
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"' echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"'
git status --porcelain -- yarn.lock git status --porcelain -- yarn.lock
exit 1 exit 1
fi fi
EOT EOT
FROM deps AS build FROM deps AS build
@@ -36,14 +36,14 @@ COPY --from=build /out /
FROM build AS build-validate FROM build AS build-validate
RUN --mount=type=bind,target=.,rw <<EOT RUN --mount=type=bind,target=.,rw <<EOT
set -e set -e
git add -A git add -A
cp -rf /out/* . cp -rf /out/* .
if [ -n "$(git status --porcelain -- dist)" ]; then if [ -n "$(git status --porcelain -- dist)" ]; then
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"' echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
git status --porcelain -- dist git status --porcelain -- dist
exit 1 exit 1
fi fi
EOT EOT
FROM deps AS format FROM deps AS format
@@ -65,7 +65,7 @@ ENV RUNNER_TEMP=/tmp/github_runner
ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache ENV RUNNER_TOOL_CACHE=/tmp/github_tool_cache
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules \
yarn run test --coverageDirectory=/tmp/coverage yarn run test --coverage --coverageDirectory=/tmp/coverage
FROM scratch AS test-coverage FROM scratch AS test-coverage
COPY --from=test /tmp/coverage / COPY --from=test /tmp/coverage /

54
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

1273
dist/licenses.txt generated vendored

File diff suppressed because it is too large Load Diff

2
dist/sourcemap-register.js generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,21 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-'));
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/metadata-action',
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
}) as {
[key: string]: string;
};
module.exports = { module.exports = {
clearMocks: true, clearMocks: true,
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'], moduleFileExtensions: ['js', 'ts'],
setupFiles: ['dotenv/config'], setupFiles: ['dotenv/config'],
testMatch: ['**/*.test.ts'], testMatch: ['**/*.test.ts'],
@@ -9,5 +25,7 @@ module.exports = {
moduleNameMapper: { moduleNameMapper: {
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs' '^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
}, },
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
verbose: true verbose: true
}; };

View File

@@ -4,9 +4,13 @@
"main": "lib/main.js", "main": "lib/main.js",
"scripts": { "scripts": {
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt", "build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
"lint": "eslint src/**/*.ts __tests__/**/*.ts", "lint": "yarn run prettier && yarn run eslint",
"format": "eslint --fix src/**/*.ts __tests__/**/*.ts", "format": "yarn run prettier:fix && yarn run eslint:fix",
"test": "jest --coverage", "eslint": "eslint --max-warnings=0 .",
"eslint:fix": "eslint --fix .",
"prettier": "prettier --check \"./**/*.ts\"",
"prettier:fix": "prettier --write \"./**/*.ts\"",
"test": "jest",
"all": "yarn run build && yarn run format && yarn test" "all": "yarn run build && yarn run format && yarn test"
}, },
"repository": { "repository": {
@@ -20,39 +24,35 @@
"tag", "tag",
"label" "label"
], ],
"author": "Docker", "author": "Docker Inc.",
"contributors": [
{
"name": "CrazyMax",
"url": "https://crazymax.dev"
}
],
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@actions/core": "^1.6.0", "@actions/core": "^1.10.1",
"@actions/github": "^5.0.1", "@actions/github": "^5.1.1",
"@docker/actions-toolkit": "^0.12.0",
"@renovate/pep440": "^1.0.0", "@renovate/pep440": "^1.0.0",
"csv-parse": "^5.0.4", "csv-parse": "^5.5.0",
"handlebars": "^4.7.7", "handlebars": "^4.7.8",
"moment": "^2.29.3", "moment": "^2.29.4",
"semver": "^7.3.7" "moment-timezone": "^0.5.43",
"semver": "^7.5.2"
}, },
"devDependencies": { "devDependencies": {
"@types/csv-parse": "^1.2.2", "@types/csv-parse": "^1.2.2",
"@types/node": "^16.11.26", "@types/node": "^20.5.9",
"@types/semver": "^7.3.9", "@types/semver": "^7.5.1",
"@typescript-eslint/eslint-plugin": "^5.14.0", "@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^5.14.0", "@typescript-eslint/parser": "^6.6.0",
"@vercel/ncc": "^0.33.3", "@vercel/ncc": "^0.38.0",
"dotenv": "^16.0.0", "dotenv": "^16.3.1",
"eslint": "^8.11.0", "eslint": "^8.48.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^26.1.1", "eslint-plugin-jest": "^27.2.3",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^5.0.0",
"jest": "^27.2.5", "jest": "^29.6.4",
"prettier": "^2.3.1", "prettier": "^3.0.3",
"ts-jest": "^27.1.2", "ts-jest": "^29.1.1",
"ts-node": "^10.7.0", "ts-node": "^10.9.1",
"typescript": "^4.4.4" "typescript": "^5.2.2"
} }
} }

View File

@@ -1,13 +1,11 @@
import {parse} from 'csv-parse/sync';
import * as core from '@actions/core'; import * as core from '@actions/core';
import {issueCommand} from '@actions/core/lib/command'; import {Context} from '@actions/github/lib/context';
import * as fs from 'fs'; import {Util} from '@docker/actions-toolkit/lib/util';
import * as os from 'os'; import {Git} from '@docker/actions-toolkit/lib/git';
import * as path from 'path'; import {GitHub} from '@docker/actions-toolkit/lib/github';
let _tmpDir: string;
export interface Inputs { export interface Inputs {
context: ContextSource;
images: string[]; images: string[];
tags: string[]; tags: string[];
flavor: string[]; flavor: string[];
@@ -18,63 +16,58 @@ export interface Inputs {
githubToken: string; githubToken: string;
} }
export function tmpDir(): string {
if (!_tmpDir) {
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-metadata-action-')).split(path.sep).join(path.posix.sep);
}
return _tmpDir;
}
export function getInputs(): Inputs { export function getInputs(): Inputs {
return { return {
images: getInputList('images', true), context: (core.getInput('context') || ContextSource.workflow) as ContextSource,
tags: getInputList('tags', true), images: Util.getInputList('images', {ignoreComma: true, comment: '#'}),
flavor: getInputList('flavor', true), tags: Util.getInputList('tags', {ignoreComma: true, comment: '#'}),
labels: getInputList('labels', true), flavor: Util.getInputList('flavor', {ignoreComma: true, comment: '#'}),
sepTags: core.getInput('sep-tags') || `\n`, labels: Util.getInputList('labels', {ignoreComma: true, comment: '#'}),
sepLabels: core.getInput('sep-labels') || `\n`, sepTags: core.getInput('sep-tags', {trimWhitespace: false}) || `\n`,
sepLabels: core.getInput('sep-labels', {trimWhitespace: false}) || `\n`,
bakeTarget: core.getInput('bake-target') || `docker-metadata-action`, bakeTarget: core.getInput('bake-target') || `docker-metadata-action`,
githubToken: core.getInput('github-token') githubToken: core.getInput('github-token')
}; };
} }
export function getInputList(name: string, ignoreComma?: boolean): string[] { export enum ContextSource {
const res: Array<string> = []; workflow = 'workflow',
git = 'git'
const items = core.getInput(name);
if (items == '') {
return res;
}
const records = parse(items, {
columns: false,
relaxQuotes: true,
comment: '#',
relaxColumnCount: true,
skipEmptyLines: true
});
for (const record of records as Array<string[]>) {
if (record.length == 1) {
res.push(record[0]);
continue;
} else if (!ignoreComma) {
res.push(...record);
continue;
}
res.push(record.join(','));
}
return res.filter(item => item).map(pat => pat.trim());
} }
export const asyncForEach = async (array, callback) => { export async function getContext(source: ContextSource): Promise<Context> {
for (let index = 0; index < array.length; index++) { switch (source) {
await callback(array[index], index, array); case ContextSource.workflow:
return getContextFromWorkflow();
case ContextSource.git:
return await getContextFromGit();
default:
throw new Error(`Invalid context source: ${source}`);
} }
}; }
// FIXME: Temp fix https://github.com/actions/toolkit/issues/777 function getContextFromWorkflow(): Context {
export function setOutput(name: string, value: unknown): void { const context = GitHub.context;
issueCommand('set-output', {name}, value);
// Needs to override Git reference with pr ref instead of upstream branch ref
// for pull_request_target event
// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
if (/pull_request_target/.test(context.eventName)) {
context.ref = `refs/pull/${context.payload.number}/merge`;
}
// DOCKER_METADATA_PR_HEAD_SHA env var can be used to set associated head
// SHA instead of commit SHA that triggered the workflow on pull request
// event.
if (/true/i.test(process.env.DOCKER_METADATA_PR_HEAD_SHA || '')) {
if ((/pull_request/.test(context.eventName) || /pull_request_target/.test(context.eventName)) && context.payload?.pull_request?.head?.sha != undefined) {
context.sha = context.payload.pull_request.head.sha;
}
}
return context;
}
async function getContextFromGit(): Promise<Context> {
return await Git.context();
} }

View File

@@ -1,16 +0,0 @@
import * as github from '@actions/github';
import {Context} from '@actions/github/lib/context';
import {components as OctoOpenApiTypes} from '@octokit/openapi-types';
export type ReposGetResponseData = OctoOpenApiTypes['schemas']['repository'];
export function context(): Context {
return github.context;
}
export async function repo(token: string): Promise<ReposGetResponseData> {
return github
.getOctokit(token)
.rest.repos.get({...github.context.repo})
.then(response => response.data as ReposGetResponseData);
}

View File

@@ -1,20 +1,29 @@
import * as fs from 'fs'; import * as fs from 'fs';
import {getInputs, Inputs, setOutput} from './context';
import * as github from './github';
import {Meta, Version} from './meta';
import * as core from '@actions/core'; import * as core from '@actions/core';
import {Context} from '@actions/github/lib/context'; import * as actionsToolkit from '@docker/actions-toolkit';
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
async function run() { import {getContext, getInputs, Inputs} from './context';
try { import {Meta, Version} from './meta';
const inputs: Inputs = await getInputs();
function setOutput(name: string, value: string) {
core.setOutput(name, value);
core.exportVariable(`DOCKER_METADATA_OUTPUT_${name.replace(/\W/g, '_').toUpperCase()}`, value);
}
actionsToolkit.run(
// main
async () => {
const inputs: Inputs = getInputs();
if (inputs.images.length == 0) { if (inputs.images.length == 0) {
throw new Error(`images input required`); throw new Error(`images input required`);
} }
const context: Context = github.context(); const toolkit = new Toolkit({githubToken: inputs.githubToken});
const repo: github.ReposGetResponseData = await github.repo(inputs.githubToken); const context = await getContext(inputs.context);
core.startGroup(`Context info`); const repo = await toolkit.github.repoData();
await core.group(`Context info`, async () => {
core.info(`eventName: ${context.eventName}`); core.info(`eventName: ${context.eventName}`);
core.info(`sha: ${context.sha}`); core.info(`sha: ${context.sha}`);
core.info(`ref: ${context.ref}`); core.info(`ref: ${context.ref}`);
@@ -23,12 +32,12 @@ async function run() {
core.info(`actor: ${context.actor}`); core.info(`actor: ${context.actor}`);
core.info(`runNumber: ${context.runNumber}`); core.info(`runNumber: ${context.runNumber}`);
core.info(`runId: ${context.runId}`); core.info(`runId: ${context.runId}`);
core.endGroup(); });
if (core.isDebug()) { if (core.isDebug()) {
core.startGroup(`Webhook payload`); await core.group(`Webhook payload`, async () => {
core.info(JSON.stringify(context.payload, null, 2)); core.info(JSON.stringify(context.payload, null, 2));
core.endGroup(); });
} }
const meta: Meta = new Meta(inputs, context, repo); const meta: Meta = new Meta(inputs, context, repo);
@@ -37,9 +46,9 @@ async function run() {
if (meta.version.main == undefined || meta.version.main.length == 0) { if (meta.version.main == undefined || meta.version.main.length == 0) {
core.warning(`No Docker image version has been generated. Check tags input.`); core.warning(`No Docker image version has been generated. Check tags input.`);
} else { } else {
core.startGroup(`Docker image version`); await core.group(`Docker image version`, async () => {
core.info(version.main || ''); core.info(version.main || '');
core.endGroup(); });
} }
setOutput('version', version.main || ''); setOutput('version', version.main || '');
@@ -48,39 +57,35 @@ async function run() {
if (tags.length == 0) { if (tags.length == 0) {
core.warning('No Docker tag has been generated. Check tags input.'); core.warning('No Docker tag has been generated. Check tags input.');
} else { } else {
core.startGroup(`Docker tags`); await core.group(`Docker tags`, async () => {
for (const tag of tags) { for (const tag of tags) {
core.info(tag); core.info(tag);
} }
core.endGroup(); });
} }
setOutput('tags', tags.join(inputs.sepTags)); setOutput('tags', tags.join(inputs.sepTags));
// Docker labels // Docker labels
const labels: Array<string> = meta.getLabels(); const labels: Array<string> = meta.getLabels();
core.startGroup(`Docker labels`); await core.group(`Docker labels`, async () => {
for (const label of labels) { for (const label of labels) {
core.info(label); core.info(label);
} }
core.endGroup();
setOutput('labels', labels.join(inputs.sepLabels)); setOutput('labels', labels.join(inputs.sepLabels));
});
// JSON // JSON
const jsonOutput = meta.getJSON(); const jsonOutput = meta.getJSON();
core.startGroup(`JSON output`); await core.group(`JSON output`, async () => {
core.info(JSON.stringify(jsonOutput, null, 2)); core.info(JSON.stringify(jsonOutput, null, 2));
core.endGroup(); setOutput('json', JSON.stringify(jsonOutput));
setOutput('json', jsonOutput); });
// Bake definition file // Bake file definition
const bakeFile: string = meta.getBakeFile(); const bakeFile: string = meta.getBakeFile();
core.startGroup(`Bake definition file`); await core.group(`Bake file definition`, async () => {
core.info(fs.readFileSync(bakeFile, 'utf8')); core.info(fs.readFileSync(bakeFile, 'utf8'));
core.endGroup();
setOutput('bake-file', bakeFile); setOutput('bake-file', bakeFile);
} catch (error) { });
core.setFailed(error.message);
} }
} );
run();

View File

@@ -1,16 +1,18 @@
import * as handlebars from 'handlebars'; import * as handlebars from 'handlebars';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import moment from 'moment'; import moment from 'moment-timezone';
import * as pep440 from '@renovate/pep440'; import * as pep440 from '@renovate/pep440';
import * as semver from 'semver'; import * as semver from 'semver';
import {Inputs, tmpDir} from './context'; import * as core from '@actions/core';
import {ReposGetResponseData} from './github'; import {Context} from '@actions/github/lib/context';
import {Context as ToolkitContext} from '@docker/actions-toolkit/lib/context';
import {GitHubRepo} from '@docker/actions-toolkit/lib/types/github';
import {Inputs} from './context';
import * as icl from './image'; import * as icl from './image';
import * as tcl from './tag'; import * as tcl from './tag';
import * as fcl from './flavor'; import * as fcl from './flavor';
import * as core from '@actions/core';
import {Context} from '@actions/github/lib/context';
export interface Version { export interface Version {
main: string | undefined; main: string | undefined;
@@ -23,20 +25,13 @@ export class Meta {
private readonly inputs: Inputs; private readonly inputs: Inputs;
private readonly context: Context; private readonly context: Context;
private readonly repo: ReposGetResponseData; private readonly repo: GitHubRepo;
private readonly images: icl.Image[]; private readonly images: icl.Image[];
private readonly tags: tcl.Tag[]; private readonly tags: tcl.Tag[];
private readonly flavor: fcl.Flavor; private readonly flavor: fcl.Flavor;
private readonly date: Date; private readonly date: Date;
constructor(inputs: Inputs, context: Context, repo: ReposGetResponseData) { constructor(inputs: Inputs, context: Context, repo: GitHubRepo) {
// Needs to override Git reference with pr ref instead of upstream branch ref
// for pull_request_target event
// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target
if (/pull_request_target/.test(context.eventName)) {
context.ref = `refs/pull/${context.payload.number}/merge`;
}
this.inputs = inputs; this.inputs = inputs;
this.context = context; this.context = context;
this.repo = repo; this.repo = repo;
@@ -120,8 +115,19 @@ export class Meta {
const currentDate = this.date; const currentDate = this.date;
const vraw = this.setValue( const vraw = this.setValue(
handlebars.compile(tag.attrs['pattern'])({ handlebars.compile(tag.attrs['pattern'])({
date: function (format) { date: function (format, options) {
return moment(currentDate).utc().format(format); const m = moment(currentDate);
let tz = 'UTC';
Object.keys(options.hash).forEach(key => {
switch (key) {
case 'tz':
tz = options.hash[key];
break;
default:
throw new Error(`Unknown ${key} attribute`);
}
});
return m.tz(tz).format(format);
} }
}), }),
tag tag
@@ -148,7 +154,7 @@ export class Meta {
let latest = false; let latest = false;
const sver = semver.parse(vraw, { const sver = semver.parse(vraw, {
includePrerelease: true loose: true
}); });
if (semver.prerelease(vraw)) { if (semver.prerelease(vraw)) {
if (Meta.isRawStatement(tag.attrs['pattern'])) { if (Meta.isRawStatement(tag.attrs['pattern'])) {
@@ -301,7 +307,7 @@ export class Meta {
let val = this.context.sha; let val = this.context.sha;
if (tag.attrs['format'] === tcl.ShaFormat.Short) { if (tag.attrs['format'] === tcl.ShaFormat.Short) {
val = this.context.sha.substr(0, 7); val = this.context.sha.substring(0, 7);
} }
const vraw = this.setValue(val, tag); const vraw = this.setValue(val, tag);
@@ -351,59 +357,70 @@ export class Meta {
} }
private setGlobalExp(val): string { private setGlobalExp(val): string {
const ctx = this.context; const context = this.context;
const currentDate = this.date; 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(context.ref)) {
return ''; return '';
} }
return ctx.ref.replace(/^refs\/heads\//g, ''); return context.ref.replace(/^refs\/heads\//g, '');
}, },
tag: function () { tag: function () {
if (!/^refs\/tags\//.test(ctx.ref)) { if (!/^refs\/tags\//.test(context.ref)) {
return ''; return '';
} }
return ctx.ref.replace(/^refs\/tags\//g, ''); return context.ref.replace(/^refs\/tags\//g, '');
}, },
sha: function () { sha: function () {
return ctx.sha.substr(0, 7); return context.sha.substring(0, 7);
}, },
base_ref: function () { base_ref: function () {
if (/^refs\/tags\//.test(ctx.ref) && ctx.payload?.base_ref != undefined) { if (/^refs\/tags\//.test(context.ref) && context.payload?.base_ref != undefined) {
return ctx.payload.base_ref.replace(/^refs\/heads\//g, ''); return context.payload.base_ref.replace(/^refs\/heads\//g, '');
} }
// FIXME: keep this for backward compatibility even if doesn't always seem // FIXME: keep this for backward compatibility even if doesn't always seem
// to return the expected branch. See the comment below. // to return the expected branch. See the comment below.
if (/^refs\/pull\//.test(ctx.ref) && ctx.payload?.pull_request?.base?.ref != undefined) { if (/^refs\/pull\//.test(context.ref) && context.payload?.pull_request?.base?.ref != undefined) {
return ctx.payload.pull_request.base.ref; return context.payload.pull_request.base.ref;
} }
return ''; return '';
}, },
is_default_branch: function () { is_default_branch: function () {
const branch = ctx.ref.replace(/^refs\/heads\//g, ''); const branch = context.ref.replace(/^refs\/heads\//g, '');
// TODO: "base_ref" is available in the push payload but doesn't always seem to // TODO: "base_ref" is available in the push payload but doesn't always seem to
// return the expected branch when the push tag event occurs. It's also not // return the expected branch when the push tag event occurs. It's also not
// documented in GitHub docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push // documented in GitHub docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push
// more context: https://github.com/docker/metadata-action/pull/192#discussion_r854673012 // more context: https://github.com/docker/metadata-action/pull/192#discussion_r854673012
// if (/^refs\/tags\//.test(ctx.ref) && ctx.payload?.base_ref != undefined) { // if (/^refs\/tags\//.test(context.ref) && context.payload?.base_ref != undefined) {
// branch = ctx.payload.base_ref.replace(/^refs\/heads\//g, ''); // branch = context.payload.base_ref.replace(/^refs\/heads\//g, '');
// } // }
if (branch == undefined || branch.length == 0) { if (branch == undefined || branch.length == 0) {
return 'false'; return 'false';
} }
if (ctx.payload?.repository?.default_branch == branch) { if (context.payload?.repository?.default_branch == branch) {
return 'true'; return 'true';
} }
// following events always trigger for last commit on default branch // following events always trigger for last commit on default branch
// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows // https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
if (/create/.test(ctx.eventName) || /discussion/.test(ctx.eventName) || /issues/.test(ctx.eventName) || /schedule/.test(ctx.eventName)) { if (/create/.test(context.eventName) || /discussion/.test(context.eventName) || /issues/.test(context.eventName) || /schedule/.test(context.eventName)) {
return 'true'; return 'true';
} }
return 'false'; return 'false';
}, },
date: function (format) { date: function (format, options) {
return moment(currentDate).utc().format(format); const m = moment(currentDate);
let tz = 'UTC';
Object.keys(options.hash).forEach(key => {
switch (key) {
case 'tz':
tz = options.hash[key];
break;
default:
throw new Error(`Unknown ${key} attribute`);
}
});
return m.tz(tz).format(format);
} }
}); });
} }
@@ -449,7 +466,18 @@ export class Meta {
`org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}` `org.opencontainers.image.licenses=${this.repo.license?.spdx_id || ''}`
]; ];
labels.push(...this.inputs.labels); labels.push(...this.inputs.labels);
return labels;
return Array.from(
new Map<string, string>(
labels
.map(label => label.split('='))
// eslint-disable-next-line @typescript-eslint/no-unused-vars
.filter(([_key, ...values]) => values.length > 0)
.map(([key, ...values]) => [key, values.join('=')] as [string, string])
)
)
.sort((a, b) => a[0].localeCompare(b[0]))
.map(([key, value]) => `${key}=${value}`);
} }
public getJSON(): unknown { public getJSON(): unknown {
@@ -467,7 +495,7 @@ export class Meta {
} }
public getBakeFile(): string { public getBakeFile(): string {
const bakeFile = path.join(tmpDir(), 'docker-metadata-action-bake.json').split(path.sep).join(path.posix.sep); const bakeFile = path.join(ToolkitContext.tmpDir(), 'docker-metadata-action-bake.json');
fs.writeFileSync( fs.writeFileSync(
bakeFile, bakeFile,
JSON.stringify( JSON.stringify(

View File

@@ -95,7 +95,7 @@ export function Parse(s: string): Tag {
for (const field of fields) { for (const field of fields) {
const parts = field const parts = field
.toString() .toString()
.split('=') .split(/(?<=^[^=]+?)=/)
.map(item => item.trim()); .map(item => item.trim());
if (parts.length == 1) { if (parts.length == 1) {
tag.attrs['value'] = parts[0]; tag.attrs['value'] = parts[0];

View File

@@ -1,3 +1,3 @@
# syntax=docker/dockerfile:1
FROM alpine FROM alpine
RUN echo "Hello world!" RUN echo "Hello world!"

12
test/output.Dockerfile Normal file
View File

@@ -0,0 +1,12 @@
# syntax=docker/dockerfile:1
FROM alpine
RUN apk add --no-cache coreutils jq
ARG DOCKER_METADATA_OUTPUT_VERSION
ARG DOCKER_METADATA_OUTPUT_TAGS
ARG DOCKER_METADATA_OUTPUT_LABELS
ARG DOCKER_METADATA_OUTPUT_JSON
RUN printenv DOCKER_METADATA_OUTPUT_VERSION
RUN printenv DOCKER_METADATA_OUTPUT_TAGS
RUN printenv DOCKER_METADATA_OUTPUT_LABELS
RUN printenv DOCKER_METADATA_OUTPUT_JSON
RUN echo $DOCKER_METADATA_OUTPUT_JSON | jq

View File

@@ -1,20 +1,22 @@
{ {
"compilerOptions": { "compilerOptions": {
"esModuleInterop": true,
"target": "es6", "target": "es6",
"module": "commonjs", "module": "commonjs",
"strict": true,
"newLine": "lf", "newLine": "lf",
"outDir": "./lib", "outDir": "./lib",
"rootDir": "./src", "rootDir": "./src",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": false, "noImplicitAny": false,
"resolveJsonModule": true, "resolveJsonModule": true,
"useUnknownInCatchVariables": false, "useUnknownInCatchVariables": false,
}, },
"exclude": [ "exclude": [
"./__mocks__/**/*",
"./__tests__/**/*",
"./lib/**/*",
"node_modules", "node_modules",
"**/*.test.ts",
"jest.config.ts" "jest.config.ts"
] ]
} }

2979
yarn.lock

File diff suppressed because it is too large Load Diff