You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -472,17 +472,12 @@ using [actions/cache](https://github.com/actions/cache) with this action:
472
472
> If you want to [export layers for all stages](https://github.com/docker/buildx#--cache-tonametypetypekeyvalue),
473
473
> you have to specify `mode=max` attribute in `cache-to`.
474
474
475
-
### Complete workflow
475
+
### Handle tags and labels
476
476
477
477
If you come from [`v1`](https://github.com/docker/build-push-action/tree/releases/v1#readme) and want an
478
-
"automatic"tag management through Git reference and [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)
479
-
for labels, you will have to do it in a dedicated step.
480
-
481
-
The following workflow with the `Prepare` step will generate some [outputs](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjobs_idoutputs)
482
-
to handle tags and labels based on GitHub actions events.
483
-
484
-
This is just an example to show many cases that you might want to use and that you will have to adapt according
485
-
to your needs:
478
+
"automatic"tag management and [OCI Image Format Specification](https://github.com/opencontainers/image-spec/blob/master/annotations.md)
479
+
for labels, you can do it in a dedicated step. The following workflow will use the [Docker meta action](https://github.com/crazy-max/ghaction-docker-meta)
480
+
to handle tags and labels based on GitHub actions events and Git metadata.
486
481
487
482
<details>
488
483
<summary><b>Show workflow</b></summary>
@@ -508,42 +503,12 @@ to your needs:
508
503
name: Checkout
509
504
uses: actions/checkout@v2
510
505
-
511
-
name: Repo metadata
512
-
id: repo
513
-
uses: actions/github-script@v3
506
+
name: Docker meta
507
+
id: docker_meta
508
+
uses: crazy-max/ghaction-docker-meta@v1
514
509
with:
515
-
script: |
516
-
const repo = await github.repos.get(context.repo)
517
-
return repo.data
518
-
-
519
-
name: Prepare
520
-
id: prep
521
-
run: |
522
-
DOCKER_IMAGE=name/app
523
-
VERSION=noop
524
-
if [ "${{ github.event_name }}" = "schedule" ]; then
525
-
VERSION=nightly
526
-
elif [[ $GITHUB_REF == refs/tags/* ]]; then
527
-
VERSION=${GITHUB_REF#refs/tags/}
528
-
elif [[ $GITHUB_REF == refs/heads/* ]]; then
529
-
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
530
-
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
531
-
VERSION=edge
532
-
fi
533
-
elif [[ $GITHUB_REF == refs/pull/* ]]; then
534
-
VERSION=pr-${{ github.event.number }}
535
-
fi
536
-
TAGS="${DOCKER_IMAGE}:${VERSION}"
537
-
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
You can update the [DockerHub repository description](https://docs.docker.com/docker-hub/repos/) using
@@ -673,7 +621,7 @@ Following inputs can be used as `step.with` keys
673
621
| `cache-from` | List | List of [external cache sources](https://github.com/docker/buildx#--cache-fromnametypetypekeyvalue) (eg. `type=local,src=path/to/dir`) |
674
622
| `cache-to` | List | List of [cache export destinations](https://github.com/docker/buildx#--cache-tonametypetypekeyvalue) (eg. `type=local,dest=path/to/dir`) |
675
623
| `secrets` | List | List of secrets to expose to the build (eg. `key=value`, `GIT_AUTH_TOKEN=mytoken`) |
676
-
| `ssh` | List | List of SSH agent socket or keys to expose to the build (eg: `default|<id>[=<socket>|<key>[,<key>]]`) |
624
+
| `ssh` | List | List of SSH agent socket or keys to expose to the build |
0 commit comments