@ -145,6 +150,8 @@ Whether to push the built image.
## Example usage
## Example usage
### Simple example
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`:
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
```yaml
@ -156,6 +163,8 @@ with:
tags: latest
tags: latest
```
```
### Auto-tagging example
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`:
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
```yaml
@ -168,6 +177,8 @@ with:
tag_with_sha: true
tag_with_sha: true
```
```
### Push filter example
The following will only push the image when the event that kicked off the workflow was a push of a git tag:
The following will only push the image when the event that kicked off the workflow was a push of a git tag:
```yaml
```yaml
@ -180,6 +191,8 @@ with:
push: ${{ startsWith(github.ref, 'refs/tags/') }}
push: ${{ startsWith(github.ref, 'refs/tags/') }}
```
```
### Chain build example
The following builds the `mytarget` stage and pushes that:
The following builds the `mytarget` stage and pushes that:
```yaml
```yaml
@ -190,4 +203,18 @@ with:
repository: myorg/myrepository
repository: myorg/myrepository
tag_with_ref: true
tag_with_ref: true
target: mytarget
target: mytarget
```
```
### GitHub package registry example
The following pushes the image to the [GitHub package registry](https://help.github.com/en/packages/publishing-and-managing-packages/about-github-packages) using your GitHub username and token as credentials: