2020-11-13 14:52:22 +00:00
# push-to-registry
2020-11-17 19:19:05 +00:00
[](https://github.com/redhat-actions/push-to-registry/actions?query=workflow%3A%22Verify+Bundle%22)
2020-11-17 03:37:48 +00:00
[](https://github.com/redhat-actions/push-to-registry/tags)
[](./LICENSE)
[](./dist)
2020-11-17 03:34:16 +00:00
Push-to-registry is a GitHub Action for pushing an OCI-compatible image to an image registry, such as Dockerhub, Quay. io, or an OpenShift integrated registry.
2020-11-13 14:52:22 +00:00
2020-11-23 23:11:35 +00:00
This action only runs on Linux, as it uses [podman ](https://github.com/containers/Podman ) to perform the push. [GitHub's Ubuntu action runners ](https://github.com/actions/virtual-environments#available-environments ) come with Podman preinstalled. If you are not using those runners, you must first [install Podman ](https://podman.io/getting-started/installation ).
2020-11-13 14:52:22 +00:00
## Action Inputs
< table >
< thead >
< tr >
2020-11-17 03:34:16 +00:00
< th > Input< / th >
< th > Required< / th >
2020-11-13 14:52:22 +00:00
< th > Description< / th >
< / tr >
< / thead >
< tr >
2020-11-17 19:19:05 +00:00
< td > image< / td >
2020-11-17 03:34:16 +00:00
< td > Yes< / td >
< td >
2020-11-18 00:00:31 +00:00
Name of the image you want to push.
2020-11-17 03:34:16 +00:00
< / td >
2020-11-13 14:52:22 +00:00
< / tr >
< tr >
< td > tag< / td >
2020-11-17 03:34:16 +00:00
< td > No< / td >
< td >
Image tag to push.< br >
Defaults to < code > latest< / code > .
< / td >
2020-11-13 14:52:22 +00:00
< / tr >
< tr >
< td > registry< / td >
2020-11-17 03:34:16 +00:00
< td > Yes< / td >
< td > URL of the registry to push the image to.< br >
2020-11-18 00:00:31 +00:00
Eg. < code > quay.io/< username> < / code > < / td >
2020-11-13 14:52:22 +00:00
< / tr >
< tr >
< td > username< / td >
2020-11-17 03:34:16 +00:00
< td > Yes< / td >
< td > Username with which to authenticate to the registry.< / td >
2020-11-13 14:52:22 +00:00
< / tr >
< tr >
< td > password< / td >
2020-11-17 03:34:16 +00:00
< td > Yes< / td >
2020-11-23 23:11:35 +00:00
< td > Password, encrypted password, or access token with which to authenticate to the registry.< / td >
2020-11-13 14:52:22 +00:00
< / tr >
< / table >
2020-11-23 23:11:35 +00:00
## Action Outputs
This action produces these outputs which can be used for further processing in different Github action:
`registry-path` : The registry path to which the image was pushed.< br >
For example, `quay.io/username/spring-image:v1` .
2020-11-16 13:06:29 +00:00
## Examples
2020-11-23 23:11:35 +00:00
The example below shows how the `push-to-registry` action can be used to push an image created by the [buildah-build ](https://github.com/redhat-actions/buildah-build ) action.
2020-11-16 13:06:29 +00:00
2020-11-17 03:34:16 +00:00
```yaml
name: Build and Push Image
2020-11-16 13:06:29 +00:00
on: [push]
jobs:
build:
2020-11-23 23:11:35 +00:00
name: Build and push image
2020-11-16 13:06:29 +00:00
runs-on: ubuntu-latest
2020-11-17 03:34:16 +00:00
env:
2020-11-23 23:11:35 +00:00
IMAGE_NAME: my-app
IMAGE_TAG: latest
2020-11-16 13:06:29 +00:00
steps:
2020-11-18 00:00:31 +00:00
- uses: actions/checkout@v2
2020-11-17 03:34:16 +00:00
- name: Build Image
2020-11-23 23:11:35 +00:00
uses: redhat-actions/buildah-build@v1
2020-11-16 13:06:29 +00:00
with:
2020-11-23 23:11:35 +00:00
image: ${{ env.IMAGE_NAME }}
tag: ${{ env.TAG }}
dockerfiles: |
./Dockerfile
2020-11-16 13:06:29 +00:00
- name: Push To Quay
2020-11-23 23:11:35 +00:00
id: push-to-quay
2020-11-18 00:00:31 +00:00
uses: redhat-actions/push-to-registry@v1
2020-11-16 13:06:29 +00:00
with:
2020-11-17 19:19:05 +00:00
image: ${{ env.IMAGE_NAME }}
2020-11-23 23:11:35 +00:00
tag: ${{ env.TAG }}
2020-11-16 13:06:29 +00:00
registry: ${{ secrets.QUAY_REPO }}
username: ${{ secrets.QUAY_USERNAME }}
2020-11-17 03:34:16 +00:00
password: ${{ secrets.QUAY_TOKEN }}
2020-11-23 23:11:35 +00:00
# The output is stored in ${{ steps.push-to-quay.outputs.registry-path }}
2020-11-16 13:06:29 +00:00
```
2020-11-13 14:52:22 +00:00
## Contributing
This is an open source project open to anyone. This project welcomes contributions and suggestions!
## Feedback & Questions
If you discover an issue please file a bug in [GitHub issues ](https://github.com/redhat-actions/push-to-registry/issues ) and we will fix it as soon as possible.
## License
2020-11-17 03:34:16 +00:00
MIT, See [LICENSE ](./LICENSE ) for more information.