Skip to content

Commit d360055

Browse files
initial commit
0 parents  commit d360055

File tree

3 files changed

+200
-0
lines changed

3 files changed

+200
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Christian Korneck
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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.

action.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'update-container-description-action'
2+
description: 'github action to update the description of a container repo from a README file (Docker Hub, Harbor, Quay)'
3+
inputs:
4+
destination_container_repo:
5+
description: 'the destination container repo (i.e. my-user/my-repo or myserver.com/my-user/my-repo)'
6+
required: true
7+
provider:
8+
description: 'repo provider type (dockerhub, quay, harbor2)'
9+
required: false
10+
default: 'dockerhub'
11+
short_description:
12+
description: 'Dockerhub only: Set or update the repo short description'
13+
default: ''
14+
required: false
15+
readme_file:
16+
description: 'Path to the source README file'
17+
default: 'README.md'
18+
required: false
19+
runs:
20+
using: 'docker'
21+
image: 'docker://docker.io/chko/docker-pushrm:1'
22+
args:
23+
- '--provider'
24+
- '${{ inputs.provider }}'
25+
- '--short'
26+
- '${{ inputs.short_description }}'
27+
- '--file'
28+
- '${{ inputs.readme_file }}'
29+
- '--debug'
30+
- '${{ inputs.destination_container_repo }}'
31+
branding:
32+
icon: 'file-text'
33+
color: 'green'

0 commit comments

Comments
 (0)