From 88f377f59be2db2279130c2da94d189b1325c7b3 Mon Sep 17 00:00:00 2001 From: smac89 <8305511+smac89@users.noreply.github.com> Date: Sun, 18 Apr 2021 02:16:24 -0600 Subject: [PATCH] ghcr login example Add example of logging into github's container registry --- README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index dcd1adb..bc071d7 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This action only runs on `Linux`, as it uses [podman](https://github.com/contain | password | Password, encrypted password, or access token for `username`. | **Must be provided** | logout | By default, the action logs out of the container image registry at the end of the job (for self-hosted runners). Set this to `false` to disable this behaviour. | `true` -## Example +## Examples The example below shows how the `podman-login` action can be used to log in to `quay.io` container image registry. @@ -56,3 +56,30 @@ jobs: # Now you can push images, and pull private ones, from quay.io as 'quayuser'. ``` + +Logging into `github`'s container registry is just as easy: + +``` +name: Log in to ghcr.io +on: + push: + +env: + REGISTRY_USER: ${{ github.actor }} + REGISTRY_PASSWORD: ${{ github.token }} + IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} + +jobs: + login: + name: Login to GitHub Container Registry + runs-on: ubuntu-latest + steps: + - name: Log in to Ghrc.io + uses: redhat-actions/podman-login@v1 + with: + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} + registry: ${{ env.IMAGE_REGISTRY }} + + # Now you can push images, and pull private ones, from ghcr.io. +```