Compare commits

..

8 Commits

Author SHA1 Message Date
ab83648e2e Merge pull request #106 from docker/deprecation-notice
Add deprecation notice (v2 available)
2020-09-08 14:11:29 -07:00
35323d9aa4 Add deprecation notice (v2 available)
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2020-09-08 23:08:57 +02:00
836357fa9e Merge pull request #54 from mikemol/patch-1
Demonstrate simple ref tag
2020-07-16 09:08:40 -07:00
8e21df3514 Merge pull request #75 from rcorrear/patch-1
Update README.md
2020-07-16 09:03:21 -07:00
5aca64f130 Update README.md
Add checkout step to examples.

Signed-off-by: Ricardo Correa <r.correa.r@gmail.com>
2020-07-16 12:09:10 +02:00
7cb863f593 Merge pull request #45 from gkkachi/fix-typo-gcr
Fix typo
2020-06-15 15:23:21 +02:00
6115ff08ad Demonstrate simple ref tag
Existing ref tag examples highlighted special cases, but none demonstrated the simplest branch case.

Signed-off-by: Michael Mol <mikemol@gmail.com>
2020-06-06 20:02:18 +00:00
68257a7f8a Fix typo
Signed-off-by: Konosuke Kachi <github@s.k-kachi.net>
2020-05-16 15:25:56 +09:00
2 changed files with 62 additions and 35 deletions

View File

@ -69,6 +69,7 @@ Examples:
|Git Reference|Image tag|
|---|---|
|`refs/heads/master`|`latest`|
|`refs/heads/mybranch`|`mybranch`|
|`refs/heads/my/branch`|`my-branch`|
|`refs/pull/2/merge`|`pr-2-merge`|
|`refs/tags/v1.0.0`|`v1.0.0`|
@ -160,58 +161,83 @@ Whether to push the built image.
The following will build the root Dockerfile, tag the image as `myorg/myrepository:latest`, log in to Docker Hub using GitHub secrets, and push the image to the Docker Hub repository `myorg/myrepository`:
```yaml
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tags: latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tags: latest
```
The following will build the root Dockerfile, tag the image with the git reference and SHA as described above, log in to Docker Hub using GitHub secrets, and push the image to the Docker Hub repository `myorg/myrepository`:
```yaml
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tag_with_ref: true
tag_with_sha: true
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tag_with_ref: true
tag_with_sha: true
```
The following will only push the image when the event that kicked off the workflow was a push of a git tag:
```yaml
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tag_with_ref: true
push: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tag_with_ref: true
push: ${{ startsWith(github.ref, 'refs/tags/') }}
```
The following builds the `mytarget` stage and pushes that:
```yaml
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tag_with_ref: true
target: mytarget
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: myorg/myrepository
tag_with_ref: true
target: mytarget
```
The following will build the root Dockerfile, tag the image as `myorg/myrepository:latest`, log in to Google Container Registry using GitHub secrets (where `DOCKER_PASSWORD` is a [JSON key](https://cloud.google.com/container-registry/docs/advanced-authentication#json-key)), and push the image to the CGR repository `myorg/myrepository`:
The following will build the root Dockerfile, tag the image as `myorg/myrepository:latest`, log in to Google Container Registry using GitHub secrets (where `DOCKER_PASSWORD` is a [JSON key](https://cloud.google.com/container-registry/docs/advanced-authentication#json-key)), and push the image to the GCR repository `myorg/myrepository`:
```yaml
uses: docker/build-push-action@v1
with:
username: _json_key
password: ${{ secrets.DOCKER_PASSWORD }}
registry: gcr.io
repository: myorg/myrepository
tags: latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: _json_key
password: ${{ secrets.DOCKER_PASSWORD }}
registry: gcr.io
repository: myorg/myrepository
tags: latest
```

View File

@ -20,6 +20,7 @@ inputs:
description: Server address of Docker registry. If not set then will default to Docker Hub
required: false
repository:
deprecationMessage: 'v2 beta is now available through docker/build-push-action@v2'
description: Docker repository to tag the image with
required: true
tags: