2020-11-13 15:52:22 +01:00
# push-to-registry
2020-11-16 22:34:16 -05:00
Push-to-registry is a GitHub Action for pushing an OCI-compatible image to an image registry, such as Dockerhub, Quay& #46 ; io, or an OpenShift integrated registry.
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-16 22:34:16 -05:00
< td > image-to-push< / td >
< td > Yes< / td >
< td >
Name of the image you want to push. Most likely the name you used to create the image in the previous step.
< / 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 >
Eg. < code > https://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 >
< td > Password or personal access token with which to authenticate to the registry.< / td >
2020-11-13 15:52:22 +01:00
< / tr >
< / table >
2020-11-16 14:06:29 +01:00
## Examples
The example below shows how the `push-to-registry` action can be used to push an image created by the [`buildah-action` ](https://github.com/redhat-actions/buildah-action ) in an early step.
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:
name: Build image
runs-on: ubuntu-latest
2020-11-16 22:34:16 -05:00
env:
IMAGE_NAME: petclinic
BUILT_JAR: "target/spring-petclinic-2.3.0.BUILD-SNAPSHOT.jar"
2020-11-16 14:06:29 +01:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Maven
run: |
cd ${GITHUB_WORKSPACE}
mvn package
2020-11-16 22:34:16 -05:00
- name: Build Image
2020-11-16 14:06:29 +01:00
uses: redhat-actions/buildah-action@0 .0.1
with:
2020-11-16 22:34:16 -05:00
new-image-name: ${{ env.IMAGE_NAME }}
2020-11-16 14:06:29 +01:00
content: |
2020-11-16 22:34:16 -05:00
${{ env.BUILT_JAR }}
2020-11-16 14:06:29 +01:00
entrypoint: |
2020-11-16 22:34:16 -05:00
java
2020-11-16 14:06:29 +01:00
-jar
2020-11-16 22:34:16 -05:00
${{ env.BUILT_JAR }}
2020-11-16 14:06:29 +01:00
port: 8080
- name: Push To Quay
uses: redhat-actions/push-to-registry@0 .0.1
with:
2020-11-16 22:34:16 -05:00
image-to-push: ${{ env.IMAGE_NAME }}
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-16 14:06:29 +01:00
```
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.