mirror of
https://github.com/docker/build-push-action.git
synced 2026-07-04 14:05:38 +00:00
Compare commits
2 Commits
ec2d640ea6
...
3f2ab651b4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f2ab651b4 | ||
|
|
ffee99bff1 |
BIN
.github/build-push-summary.png
vendored
BIN
.github/build-push-summary.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 81 KiB |
47
README.md
47
README.md
@ -19,7 +19,21 @@ ___
|
|||||||
* [Git context](#git-context)
|
* [Git context](#git-context)
|
||||||
* [Path context](#path-context)
|
* [Path context](#path-context)
|
||||||
* [Examples](#examples)
|
* [Examples](#examples)
|
||||||
* [Summaries](#summaries)
|
* [Multi-platform image](https://docs.docker.com/build/ci/github-actions/multi-platform/)
|
||||||
|
* [Secrets](https://docs.docker.com/build/ci/github-actions/secrets/)
|
||||||
|
* [Push to multi-registries](https://docs.docker.com/build/ci/github-actions/push-multi-registries/)
|
||||||
|
* [Manage tags and labels](https://docs.docker.com/build/ci/github-actions/manage-tags-labels/)
|
||||||
|
* [Cache management](https://docs.docker.com/build/ci/github-actions/cache/)
|
||||||
|
* [Export to Docker](https://docs.docker.com/build/ci/github-actions/export-docker/)
|
||||||
|
* [Test before push](https://docs.docker.com/build/ci/github-actions/test-before-push/)
|
||||||
|
* [Local registry](https://docs.docker.com/build/ci/github-actions/local-registry/)
|
||||||
|
* [Share built image between jobs](https://docs.docker.com/build/ci/github-actions/share-image-jobs/)
|
||||||
|
* [Named contexts](https://docs.docker.com/build/ci/github-actions/named-contexts/)
|
||||||
|
* [Copy image between registries](https://docs.docker.com/build/ci/github-actions/copy-image-registries/)
|
||||||
|
* [Update Docker Hub repo description](https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/)
|
||||||
|
* [SBOM and provenance attestations](https://docs.docker.com/build/ci/github-actions/attestations/)
|
||||||
|
* [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/)
|
||||||
|
* [Reproducible builds](https://docs.docker.com/build/ci/github-actions/reproducible-builds/)
|
||||||
* [Customizing](#customizing)
|
* [Customizing](#customizing)
|
||||||
* [inputs](#inputs)
|
* [inputs](#inputs)
|
||||||
* [outputs](#outputs)
|
* [outputs](#outputs)
|
||||||
@ -55,6 +69,8 @@ name: ci
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@ -92,6 +108,11 @@ expression `{{defaultContext}}`. Here we can use it to provide a subdirectory
|
|||||||
to the default Git context:
|
to the default Git context:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
-
|
||||||
|
# Setting up Docker Buildx with docker-container driver is required
|
||||||
|
# at the moment to be able to use a subdirectory with Git context
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
-
|
-
|
||||||
name: Build and push
|
name: Build and push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
@ -124,6 +145,8 @@ name: ci
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
@ -171,31 +194,11 @@ jobs:
|
|||||||
* [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/)
|
* [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/)
|
||||||
* [Reproducible builds](https://docs.docker.com/build/ci/github-actions/reproducible-builds/)
|
* [Reproducible builds](https://docs.docker.com/build/ci/github-actions/reproducible-builds/)
|
||||||
|
|
||||||
## Summaries
|
|
||||||
|
|
||||||
This action generates a [job summary](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/)
|
|
||||||
that provides a detailed overview of the build execution. The summary shows an
|
|
||||||
overview of all the steps executed during the build, including the build inputs
|
|
||||||
and eventual errors.
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
The summary also includes a link for downloading the build record with
|
|
||||||
additional details about the build, including build stats, logs, outputs, and
|
|
||||||
more. The build record can be imported to Docker Desktop for inspecting the
|
|
||||||
build in greater detail.
|
|
||||||
|
|
||||||
Summaries are enabled by default, but can be disabled with the
|
|
||||||
`DOCKER_BUILD_NO_SUMMARY` [environment variable](#environment-variables).
|
|
||||||
|
|
||||||
For more information about summaries, refer to the
|
|
||||||
[documentation](https://docs.docker.com/go/build-summary/).
|
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
### inputs
|
### inputs
|
||||||
|
|
||||||
The following inputs can be used as `step.with` keys:
|
Following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
> `List` type is a newline-delimited string
|
> `List` type is a newline-delimited string
|
||||||
> ```yaml
|
> ```yaml
|
||||||
|
|||||||
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -27,7 +27,7 @@
|
|||||||
"packageManager": "yarn@3.6.3",
|
"packageManager": "yarn@3.6.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@docker/actions-toolkit": "0.30.0",
|
"@docker/actions-toolkit": "0.29.0",
|
||||||
"handlebars": "^4.7.7"
|
"handlebars": "^4.7.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
17
src/main.ts
17
src/main.ts
@ -1,6 +1,7 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as stateHelper from './state-helper';
|
import * as stateHelper from './state-helper';
|
||||||
|
import {isGhes} from '@actions/artifact/lib/internal/shared/config';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as actionsToolkit from '@docker/actions-toolkit';
|
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||||
|
|
||||||
@ -140,14 +141,14 @@ actionsToolkit.run(
|
|||||||
await core.group(`Check build summary support`, async () => {
|
await core.group(`Check build summary support`, async () => {
|
||||||
if (process.env.DOCKER_BUILD_NO_SUMMARY && Util.parseBool(process.env.DOCKER_BUILD_NO_SUMMARY)) {
|
if (process.env.DOCKER_BUILD_NO_SUMMARY && Util.parseBool(process.env.DOCKER_BUILD_NO_SUMMARY)) {
|
||||||
core.info('Build summary disabled');
|
core.info('Build summary disabled');
|
||||||
} else if (GitHub.isGHES) {
|
|
||||||
core.warning('Build summary is not yet supported on GHES');
|
|
||||||
} else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) {
|
|
||||||
core.warning('Build summary requires Buildx >= 0.13.0');
|
|
||||||
} else if (builder && builder.driver === 'cloud') {
|
|
||||||
core.warning('Build summary is not yet supported with Docker Build Cloud');
|
|
||||||
} else if (!ref) {
|
} else if (!ref) {
|
||||||
core.warning('Build summary requires a build reference');
|
core.warning('Build summary requires a build reference');
|
||||||
|
} else if (isGhes()) {
|
||||||
|
core.warning('Build summary is not yet supported on GHES');
|
||||||
|
} else if (builder && builder.driver === 'cloud') {
|
||||||
|
core.warning('Build summary is not yet supported with Docker Build Cloud');
|
||||||
|
} else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) {
|
||||||
|
core.warning('Build summary requires Buildx >= 0.13.0');
|
||||||
} else {
|
} else {
|
||||||
core.info('Build summary supported!');
|
core.info('Build summary supported!');
|
||||||
stateHelper.setSummarySupported();
|
stateHelper.setSummarySupported();
|
||||||
@ -160,13 +161,13 @@ actionsToolkit.run(
|
|||||||
},
|
},
|
||||||
// post
|
// post
|
||||||
async () => {
|
async () => {
|
||||||
if (stateHelper.isSummarySupported) {
|
if (stateHelper.isSummarySupported && stateHelper.buildRef.length > 0) {
|
||||||
await core.group(`Generating build summary`, async () => {
|
await core.group(`Generating build summary`, async () => {
|
||||||
try {
|
try {
|
||||||
const exportRetentionDays = buildExportRetentionDays();
|
const exportRetentionDays = buildExportRetentionDays();
|
||||||
const buildxHistory = new BuildxHistory();
|
const buildxHistory = new BuildxHistory();
|
||||||
const exportRes = await buildxHistory.export({
|
const exportRes = await buildxHistory.export({
|
||||||
refs: stateHelper.buildRef ? [stateHelper.buildRef] : []
|
refs: [stateHelper.buildRef]
|
||||||
});
|
});
|
||||||
core.info(`Build record exported to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`);
|
core.info(`Build record exported to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`);
|
||||||
const uploadRes = await GitHub.uploadArtifact({
|
const uploadRes = await GitHub.uploadArtifact({
|
||||||
|
|||||||
10
yarn.lock
10
yarn.lock
@ -1055,9 +1055,9 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@docker/actions-toolkit@npm:0.30.0":
|
"@docker/actions-toolkit@npm:0.29.0":
|
||||||
version: 0.30.0
|
version: 0.29.0
|
||||||
resolution: "@docker/actions-toolkit@npm:0.30.0"
|
resolution: "@docker/actions-toolkit@npm:0.29.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@actions/artifact": ^2.1.7
|
"@actions/artifact": ^2.1.7
|
||||||
"@actions/cache": ^3.2.4
|
"@actions/cache": ^3.2.4
|
||||||
@ -1080,7 +1080,7 @@ __metadata:
|
|||||||
semver: ^7.6.2
|
semver: ^7.6.2
|
||||||
tar-stream: ^3.1.7
|
tar-stream: ^3.1.7
|
||||||
tmp: ^0.2.3
|
tmp: ^0.2.3
|
||||||
checksum: 0e5ea396c93558b4f9841485c57094a707a98cbbc4ade0de119fdf30dc4c3c7fbb0a5ed86d187f89d78db03f66ea5c6903f241d5ca87c9a0f780ae868f866310
|
checksum: c5685a5de22103d4d2cd978eaecd042be5fd8f5e166b11a1ff9f5a852b65b67969c237b43b3b742bfe85457b03ee60088e58ebc3cfa8b33b7df659e916fd4484
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -3150,7 +3150,7 @@ __metadata:
|
|||||||
resolution: "docker-build-push@workspace:."
|
resolution: "docker-build-push@workspace:."
|
||||||
dependencies:
|
dependencies:
|
||||||
"@actions/core": ^1.10.1
|
"@actions/core": ^1.10.1
|
||||||
"@docker/actions-toolkit": 0.30.0
|
"@docker/actions-toolkit": 0.29.0
|
||||||
"@types/node": ^20.12.12
|
"@types/node": ^20.12.12
|
||||||
"@typescript-eslint/eslint-plugin": ^7.9.0
|
"@typescript-eslint/eslint-plugin": ^7.9.0
|
||||||
"@typescript-eslint/parser": ^7.9.0
|
"@typescript-eslint/parser": ^7.9.0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user