|
| 1 | +# Update Container Description |
| 2 | + |
| 3 | +This github action updates the description of a container repo on [Docker Hub](https://hub.docker.com), [Quay](https://quay.io) or [Harbor](https://goharbor.io) v2 from a README file. |
| 4 | + |
| 5 | +This is useful when building and pushing Docker images with github actions. It can ensure that the description of a container repo stays in sync with the README file in the github repo. |
| 6 | + |
| 7 | +# Background |
| 8 | + |
| 9 | +This action uses [`docker-pushrm`](https://github.com/christian-korneck/docker-pushrm) (speak: *Docker Push Readme*), a commandline tool and Docker CLI plugin for updating container repo docs. |
| 10 | + |
| 11 | +# Example for Docker Hub |
| 12 | + |
| 13 | +- create a secret `DOCKER_PASS` in the github repo's settings |
| 14 | +- add to your `.github/workflows/<workflow>.yml`: |
| 15 | + |
| 16 | +``` |
| 17 | +name: Push README to Docker Hub |
| 18 | +on: push |
| 19 | +jobs: |
| 20 | + PushContainerReadme: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + name: Push README to Docker Hub |
| 23 | + steps: |
| 24 | + - name: git checkout |
| 25 | + uses: actions/checkout@v2 |
| 26 | + - name: push README to Dockerhub |
| 27 | + uses: christian-korneck/update-container-description-action@v1 |
| 28 | + env: |
| 29 | + DOCKER_USER: my-user |
| 30 | + DOCKER_PASS: ${{ secrets.DOCKER_PASS }} |
| 31 | + with: |
| 32 | + destination_container_repo: my-user/my-repo |
| 33 | + provider: dockerhub |
| 34 | + short_description: 'my short description 😊' |
| 35 | + readme_file: 'README.md' |
| 36 | +``` |
| 37 | + |
| 38 | +# Example for Quay |
| 39 | + |
| 40 | +- create an api key token in the quay.io webinterface ([how to create](https://github.com/christian-korneck/docker-pushrm#log-in-to-quay-registry)) |
| 41 | +- create a secret `APIKEY__QUAY_IO` in the github repo's settings |
| 42 | +- add to your `.github/workflows/<workflow>.yml`: |
| 43 | + |
| 44 | +``` |
| 45 | +name: Push README to Quay.io |
| 46 | +on: push |
| 47 | +jobs: |
| 48 | + PushContainerReadme: |
| 49 | + runs-on: ubuntu-latest |
| 50 | + name: Push README to Quay.io |
| 51 | + steps: |
| 52 | + - name: git checkout |
| 53 | + uses: actions/checkout@v2 |
| 54 | + - name: push README to Quay.io |
| 55 | + uses: christian-korneck/update-container-description-action@v1 |
| 56 | + env: |
| 57 | + DOCKER_APIKEY: ${{ secrets.APIKEY__QUAY_IO }} |
| 58 | + with: |
| 59 | + destination_container_repo: quay.io/my-user/my-repo |
| 60 | + provider: quay |
| 61 | + readme_file: 'README.md' |
| 62 | +``` |
| 63 | + |
| 64 | +# Example for Harbor v2 |
| 65 | + |
| 66 | +- create a secret `HARBOR_PASS` in the github repo's settings |
| 67 | +- add to your `.github/workflows/<workflow>.yml`: |
| 68 | + |
| 69 | +``` |
| 70 | +name: Push README to demo.goharbor.io |
| 71 | +on: push |
| 72 | +jobs: |
| 73 | + PushContainerReadme: |
| 74 | + runs-on: ubuntu-latest |
| 75 | + name: Push README to demo.goharbor.io |
| 76 | + steps: |
| 77 | + - name: git checkout |
| 78 | + uses: actions/checkout@v2 |
| 79 | + - name: push README to Dockerhub |
| 80 | + uses: christian-korneck/update-container-description-action@v1 |
| 81 | + env: |
| 82 | + DOCKER_USER: my-user |
| 83 | + DOCKER_PASS: ${{ secrets.HARBOR_PASS }} |
| 84 | + with: |
| 85 | + destination_container_repo: demo.goharbor.io/my-project/my-repo |
| 86 | + provider: harbor2 |
| 87 | + readme_file: 'README.md' |
| 88 | +``` |
| 89 | + |
| 90 | +# Reference |
| 91 | + |
| 92 | +## Inputs |
| 93 | + |
| 94 | +### `destination_container_repo` |
| 95 | + |
| 96 | +**Required** the destination container repo |
| 97 | +Example: `my-user/my-repo` or `myserver.com/my-user/my-repo`. |
| 98 | + |
| 99 | +### `provider` |
| 100 | + |
| 101 | +**Optional** repo provider type. |
| 102 | + |
| 103 | +Supported values: |
| 104 | +- `dockerhub` |
| 105 | +- `quay` |
| 106 | +- `harbor2` |
| 107 | + |
| 108 | +Defaults to `dockerhub` when not set. |
| 109 | + |
| 110 | +### `short_description` |
| 111 | + |
| 112 | +**Optional** Sets or updates the repo's short description (max. 100 characters). Only for provider `dockerhub`. |
| 113 | + |
| 114 | +### `readme_file` |
| 115 | + |
| 116 | +**Optional** Path to the source README file |
| 117 | +Example: `./my-README.md` |
| 118 | + |
| 119 | +Defaults to `./README.md` when not set. |
| 120 | + |
| 121 | +## Required env vars |
| 122 | + |
| 123 | +### for providers `dockerhub`, `harbor2`: |
| 124 | + |
| 125 | +- `DOCKER_USER` - username |
| 126 | +- `DOCKER_PASS` - password |
| 127 | + |
| 128 | +### for provider `quay`: |
| 129 | +- `DOCKER_APIKEY` - quay.io API key (see [here](https://github.com/christian-korneck/docker-pushrm#log-in-to-quay-registry) for how to create) |
| 130 | + |
| 131 | + |
| 132 | +## Outputs |
| 133 | + |
| 134 | +none (just succeeds or fails) |
| 135 | + |
| 136 | +# Limitations |
| 137 | + |
| 138 | +### Conflict with Dockerhub personal access tokens and 2FA auth |
| 139 | + |
| 140 | +Pushing READMEs to Dockerhub currently only works with username/password and **not** with [personal access tokens](https://docs.docker.com/docker-hub/access-tokens/). If you have [2FA auth](https://docs.docker.com/docker-hub/2fa/) (two-factor authentication) enabled for your Dockerhub account you're effectively using a personal access token. This is an unfortunate Dockerhub API limitation. |
| 141 | + |
| 142 | +There are indications (in issues and forum posts) that a new API for Dockerhub might be coming up sooner or later that might fill this gap. Fingers crossed. 🤞 |
| 143 | + |
| 144 | + |
| 145 | +---- |
| 146 | +All trademarks belong to their respective owners. |
0 commit comments