2020-11-13 15:52:22 +01:00
# push-to-registry
2020-11-17 14:19:05 -05:00
[](https://github.com/redhat-actions/push-to-registry/actions?query=workflow%3A%22Verify+Bundle%22)
2020-11-16 22:37:48 -05:00
[](https://github.com/redhat-actions/push-to-registry/tags)
[](./LICENSE)
[](./dist)
2020-11-27 11:44:15 +05:30
Push-to-registry is a GitHub Action for pushing a container image to an image registry, such as Dockerhub, Quay& #46 ; io, or an OpenShift integrated registry.
2020-11-13 15:52:22 +01:00
2020-11-23 18:11:35 -05: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 15:52:22 +01:00
## Action Inputs
< table >
< thead >
< tr >
2020-11-16 22:34:16 -05:00
< th > Input< / th >
< th > Required< / th >
2020-11-13 15:52:22 +01:00
< th > Description< / th >
< / tr >
< / thead >
< tr >
2020-11-17 14:19:05 -05:00
< td > image< / td >
2020-11-16 22:34:16 -05:00
< td > Yes< / td >
< td >
2020-11-17 19:00:31 -05:00
Name of the image you want to push.
2020-11-16 22:34:16 -05:00
< / td >
2020-11-13 15:52:22 +01:00
< / tr >
< tr >
< td > tag< / td >
2020-11-16 22:34:16 -05:00
< td > No< / td >
< td >
Image tag to push.< br >
Defaults to < code > latest< / code > .
< / td >
2020-11-13 15:52:22 +01:00
< / tr >
< tr >
< td > registry< / td >
2020-11-16 22:34:16 -05:00
< td > Yes< / td >
< td > URL of the registry to push the image to.< br >
2020-11-17 19:00:31 -05:00
Eg. < code > quay.io/< username> < / code > < / td >
2020-11-13 15:52:22 +01:00
< / tr >
< tr >
< td > username< / td >
2020-11-16 22:34:16 -05:00
< td > Yes< / td >
< td > Username with which to authenticate to the registry.< / td >
2020-11-13 15:52:22 +01:00
< / tr >
< tr >
< td > password< / td >
2020-11-16 22:34:16 -05:00
< td > Yes< / td >
2020-11-23 18:11:35 -05:00
< td > Password, encrypted password, or access token with which to authenticate to the registry.< / td >
2020-11-13 15:52:22 +01:00
< / tr >
2020-11-27 11:44:15 +05:30
< tr >
< td > tls-verify< / td >
< td > No< / td >
< td > Verify TLS certificates when contacting the registry. Set to "false" to skip certificate verification.< / td >
< / tr >
2020-11-13 15:52:22 +01:00
< / table >
2020-11-23 18:11:35 -05:00
## Action Outputs
2020-11-26 17:53:49 -05:00
This action produces one output which can be referenced in other workflow `steps` .
2020-11-23 18:11:35 -05:00
`registry-path` : The registry path to which the image was pushed.< br >
For example, `quay.io/username/spring-image:v1` .
2020-11-16 14:06:29 +01:00
## Examples
2020-11-23 18:11:35 -05: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 14:06:29 +01:00
2020-11-16 22:34:16 -05:00
```yaml
name: Build and Push Image
2020-11-16 14:06:29 +01:00
on: [push]
jobs:
build:
2020-11-23 18:11:35 -05:00
name: Build and push image
2020-11-16 14:06:29 +01:00
runs-on: ubuntu-latest
2020-11-16 22:34:16 -05:00
env:
2020-11-23 18:11:35 -05:00
IMAGE_NAME: my-app
IMAGE_TAG: latest
2020-11-16 14:06:29 +01:00
steps:
2020-11-17 19:00:31 -05:00
- uses: actions/checkout@v2
2020-11-16 22:34:16 -05:00
- name: Build Image
2020-11-23 18:11:35 -05:00
uses: redhat-actions/buildah-build@v1
2020-11-16 14:06:29 +01:00
with:
2020-11-23 18:11:35 -05:00
image: ${{ env.IMAGE_NAME }}
tag: ${{ env.TAG }}
dockerfiles: |
./Dockerfile
2020-11-16 14:06:29 +01:00
- name: Push To Quay
2020-11-23 18:11:35 -05:00
id: push-to-quay
2020-11-17 19:00:31 -05:00
uses: redhat-actions/push-to-registry@v1
2020-11-16 14:06:29 +01:00
with:
2020-11-17 14:19:05 -05:00
image: ${{ env.IMAGE_NAME }}
2020-11-23 18:11:35 -05:00
tag: ${{ env.TAG }}
2020-11-16 14:06:29 +01:00
registry: ${{ secrets.QUAY_REPO }}
username: ${{ secrets.QUAY_USERNAME }}
2020-11-16 22:34:16 -05:00
password: ${{ secrets.QUAY_TOKEN }}
2020-11-23 18:11:35 -05:00
2020-11-26 17:53:49 -05:00
- name: Use the image
run: echo "New image has been pushed to ${{ steps.push-to-quay.outputs.registry-path }}"
2020-11-16 14:06:29 +01:00
```
2020-11-26 17:53:49 -05:00
## Troubleshooting
Note that quay.io repositories are private by default.< br >
This means that if you push an image for the first time, you will have to authenticate before pulling it, or go to the repository's settings and change its visibility.
2020-11-13 15:52:22 +01: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-16 22:34:16 -05:00
MIT, See [LICENSE ](./LICENSE ) for more information.