-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d360055
Showing
3 changed files
with
200 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Christian Korneck | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# Update Container Description | ||
|
||
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. | ||
|
||
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. | ||
|
||
# Background | ||
|
||
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. | ||
|
||
# Example for Docker Hub | ||
|
||
- create a secret `DOCKER_PASS` in the github repo's settings | ||
- add to your `.github/workflows/<workflow>.yml`: | ||
|
||
``` | ||
name: Push README to Docker Hub | ||
on: push | ||
jobs: | ||
PushContainerReadme: | ||
runs-on: ubuntu-latest | ||
name: Push README to Docker Hub | ||
steps: | ||
- name: git checkout | ||
uses: actions/checkout@v2 | ||
- name: push README to Dockerhub | ||
uses: christian-korneck/update-container-description-action@v1 | ||
env: | ||
DOCKER_USER: my-user | ||
DOCKER_PASS: ${{ secrets.DOCKER_PASS }} | ||
with: | ||
destination_container_repo: my-user/my-repo | ||
provider: dockerhub | ||
short_description: 'my short description 😊' | ||
readme_file: 'README.md' | ||
``` | ||
|
||
# Example for Quay | ||
|
||
- 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)) | ||
- create a secret `APIKEY__QUAY_IO` in the github repo's settings | ||
- add to your `.github/workflows/<workflow>.yml`: | ||
|
||
``` | ||
name: Push README to Quay.io | ||
on: push | ||
jobs: | ||
PushContainerReadme: | ||
runs-on: ubuntu-latest | ||
name: Push README to Quay.io | ||
steps: | ||
- name: git checkout | ||
uses: actions/checkout@v2 | ||
- name: push README to Quay.io | ||
uses: christian-korneck/update-container-description-action@v1 | ||
env: | ||
DOCKER_APIKEY: ${{ secrets.APIKEY__QUAY_IO }} | ||
with: | ||
destination_container_repo: quay.io/my-user/my-repo | ||
provider: quay | ||
readme_file: 'README.md' | ||
``` | ||
|
||
# Example for Harbor v2 | ||
|
||
- create a secret `HARBOR_PASS` in the github repo's settings | ||
- add to your `.github/workflows/<workflow>.yml`: | ||
|
||
``` | ||
name: Push README to demo.goharbor.io | ||
on: push | ||
jobs: | ||
PushContainerReadme: | ||
runs-on: ubuntu-latest | ||
name: Push README to demo.goharbor.io | ||
steps: | ||
- name: git checkout | ||
uses: actions/checkout@v2 | ||
- name: push README to Dockerhub | ||
uses: christian-korneck/update-container-description-action@v1 | ||
env: | ||
DOCKER_USER: my-user | ||
DOCKER_PASS: ${{ secrets.HARBOR_PASS }} | ||
with: | ||
destination_container_repo: demo.goharbor.io/my-project/my-repo | ||
provider: harbor2 | ||
readme_file: 'README.md' | ||
``` | ||
|
||
# Reference | ||
|
||
## Inputs | ||
|
||
### `destination_container_repo` | ||
|
||
**Required** the destination container repo | ||
Example: `my-user/my-repo` or `myserver.com/my-user/my-repo`. | ||
|
||
### `provider` | ||
|
||
**Optional** repo provider type. | ||
|
||
Supported values: | ||
- `dockerhub` | ||
- `quay` | ||
- `harbor2` | ||
|
||
Defaults to `dockerhub` when not set. | ||
|
||
### `short_description` | ||
|
||
**Optional** Sets or updates the repo's short description (max. 100 characters). Only for provider `dockerhub`. | ||
|
||
### `readme_file` | ||
|
||
**Optional** Path to the source README file | ||
Example: `./my-README.md` | ||
|
||
Defaults to `./README.md` when not set. | ||
|
||
## Required env vars | ||
|
||
### for providers `dockerhub`, `harbor2`: | ||
|
||
- `DOCKER_USER` - username | ||
- `DOCKER_PASS` - password | ||
|
||
### for provider `quay`: | ||
- `DOCKER_APIKEY` - quay.io API key (see [here](https://github.com/christian-korneck/docker-pushrm#log-in-to-quay-registry) for how to create) | ||
|
||
|
||
## Outputs | ||
|
||
none (just succeeds or fails) | ||
|
||
# Limitations | ||
|
||
### Conflict with Dockerhub personal access tokens and 2FA auth | ||
|
||
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. | ||
|
||
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. 🤞 | ||
|
||
|
||
---- | ||
All trademarks belong to their respective owners. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: 'update-container-description-action' | ||
description: 'github action to update the description of a container repo from a README file (Docker Hub, Harbor, Quay)' | ||
inputs: | ||
destination_container_repo: | ||
description: 'the destination container repo (i.e. my-user/my-repo or myserver.com/my-user/my-repo)' | ||
required: true | ||
provider: | ||
description: 'repo provider type (dockerhub, quay, harbor2)' | ||
required: false | ||
default: 'dockerhub' | ||
short_description: | ||
description: 'Dockerhub only: Set or update the repo short description' | ||
default: '' | ||
required: false | ||
readme_file: | ||
description: 'Path to the source README file' | ||
default: 'README.md' | ||
required: false | ||
runs: | ||
using: 'docker' | ||
image: 'docker://docker.io/chko/docker-pushrm:1' | ||
args: | ||
- '--provider' | ||
- '${{ inputs.provider }}' | ||
- '--short' | ||
- '${{ inputs.short_description }}' | ||
- '--file' | ||
- '${{ inputs.readme_file }}' | ||
- '--debug' | ||
- '${{ inputs.destination_container_repo }}' | ||
branding: | ||
icon: 'file-text' | ||
color: 'green' |