Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2739a0900f | ||
|
|
84d38211e2 | ||
|
|
abea83050d | ||
|
|
3361358488 | ||
|
|
2774ff3d56 | ||
|
|
b03d823861 | ||
|
|
6de5e14b55 | ||
|
|
5b8fd77939 | ||
|
|
81f3992e82 | ||
|
|
5e7108e09c | ||
|
|
f87713fbd6 |
24
.github/workflows/dockerhub-description.yml
vendored
Normal file
24
.github/workflows/dockerhub-description.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Update Docker Hub Description
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- README.md
|
||||
- .github/workflows/dockerhub-description.yml
|
||||
jobs:
|
||||
dockerHubDescription:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Copy README.md to TEST.md
|
||||
run: |
|
||||
mkdir -p some/path
|
||||
mv README.md some/path/TEST.md
|
||||
- name: Docker Hub Description
|
||||
uses: ./
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
DOCKERHUB_REPOSITORY: peterevans/dockerhub-description
|
||||
README_FILEPATH: ./some/path/TEST.md
|
||||
16
.github/workflows/push.yml
vendored
16
.github/workflows/push.yml
vendored
@@ -1,16 +0,0 @@
|
||||
name: Update Docker Hub Description
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
dockerHubDescription:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Docker Hub Description
|
||||
uses: ./
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
DOCKERHUB_REPOSITORY: peterevans/dockerhub-description
|
||||
30
README.md
30
README.md
@@ -1,6 +1,5 @@
|
||||
# Docker Hub Description
|
||||
[](https://github.com/marketplace/actions/docker-hub-description)
|
||||
[](https://circleci.com/gh/peter-evans/dockerhub-description/tree/master)
|
||||
|
||||
A GitHub action to update a Docker Hub repository description from `README.md`.
|
||||
|
||||
@@ -10,7 +9,7 @@ This is useful if you `docker push` your images to Docker Hub. It provides an ea
|
||||
|
||||
```yml
|
||||
- name: Docker Hub Description
|
||||
uses: peter-evans/dockerhub-description@v2.0.0
|
||||
uses: peter-evans/dockerhub-description@v2.1.0
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
@@ -21,9 +20,9 @@ This is useful if you `docker push` your images to Docker Hub. It provides an ea
|
||||
|
||||
- `DOCKERHUB_USERNAME` - Docker Hub username. If updating a Docker Hub repository belonging to an organization, this user must have `Admin` permissions for the repository.
|
||||
- `DOCKERHUB_PASSWORD` - Docker Hub password.
|
||||
- `DOCKERHUB_REPOSITORY` - The Docker Hub repository to update in the format `<namespace>/<name>`.
|
||||
- `DOCKERHUB_REPOSITORY` - The Docker Hub repository to update in the format `<namespace>/<name>`. May also be passed as a secret if considered sensitive.
|
||||
|
||||
Note that `DOCKERHUB_REPOSITORY` may also be passed as a secret if considered sensitive.
|
||||
**Note**: Docker Hub [Personal Access Tokens](https://docs.docker.com/docker-hub/access-tokens/) cannot be used as they are not supported by the API. See [here](https://github.com/docker/hub-feedback/issues/1927) and [here](https://github.com/docker/hub-feedback/issues/1914) for further details. Unfortunately, this means that enabling the new 2FA feature on Docker Hub will prevent the action from working.
|
||||
|
||||
#### Optionally specifying the file path
|
||||
|
||||
@@ -32,7 +31,7 @@ If this is not the case, the path can be overridden with an environment variable
|
||||
|
||||
```yml
|
||||
- name: Docker Hub Description
|
||||
uses: peter-evans/dockerhub-description@v2.0.0
|
||||
uses: peter-evans/dockerhub-description@v2.1.0
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
@@ -42,20 +41,24 @@ If this is not the case, the path can be overridden with an environment variable
|
||||
|
||||
#### Examples
|
||||
|
||||
Updates the Docker Hub repository description whenever there is a `git push` to the `master` branch.
|
||||
The following workflow updates the Docker Hub repository description whenever there are changes to `README.md` and the workflow file itself on the `master` branch. This workflow assumes its location to be `.github/workflows/dockerhub-description.yml`.
|
||||
|
||||
```yml
|
||||
name: Update Docker Hub Description
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- master
|
||||
paths:
|
||||
- README.md
|
||||
- .github/workflows/dockerhub-description.yml
|
||||
jobs:
|
||||
dockerHubDescription:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/checkout@v2
|
||||
- name: Docker Hub Description
|
||||
uses: peter-evans/dockerhub-description@v2.0.0
|
||||
uses: peter-evans/dockerhub-description@v2.1.0
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
@@ -63,6 +66,7 @@ jobs:
|
||||
```
|
||||
|
||||
Updates the Docker Hub repository description whenever a new release is created.
|
||||
|
||||
```yml
|
||||
name: Update Docker Hub Description
|
||||
on: release
|
||||
@@ -70,9 +74,9 @@ jobs:
|
||||
dockerHubDescription:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/checkout@v2
|
||||
- name: Docker Hub Description
|
||||
uses: peter-evans/dockerhub-description@v2.0.0
|
||||
uses: peter-evans/dockerhub-description@v2.1.0
|
||||
env:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
@@ -90,9 +94,9 @@ docker run -v $PWD:/workspace \
|
||||
-e DOCKERHUB_PASSWORD='xxxxx' \
|
||||
-e DOCKERHUB_REPOSITORY='user1/my-docker-image' \
|
||||
-e README_FILEPATH='/workspace/README.md' \
|
||||
peterevans/dockerhub-description:2.0.0
|
||||
peterevans/dockerhub-description:2.1.0
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT License - see the [LICENSE](LICENSE) file for details
|
||||
[MIT](LICENSE)
|
||||
|
||||
@@ -3,7 +3,7 @@ author: 'Peter Evans'
|
||||
description: 'An action to update a Docker Hub repository description from README.md'
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'docker://peterevans/dockerhub-description:2.1.0'
|
||||
image: 'docker://peterevans/dockerhub-description:2.1.1'
|
||||
branding:
|
||||
icon: 'upload'
|
||||
color: 'blue'
|
||||
|
||||
@@ -5,6 +5,12 @@ IFS=$'\n\t'
|
||||
# Set the default path to README.md
|
||||
README_FILEPATH=${README_FILEPATH:="./README.md"}
|
||||
|
||||
# Check the file size
|
||||
if [ $(wc -c <${README_FILEPATH}) -gt 25000 ]; then
|
||||
echo "File size exceeds the maximum allowed 25000 bytes"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Acquire a token for the Docker Hub API
|
||||
echo "Acquiring token"
|
||||
LOGIN_PAYLOAD="{\"username\": \"${DOCKERHUB_USERNAME}\", \"password\": \"${DOCKERHUB_PASSWORD}\"}"
|
||||
|
||||
Reference in New Issue
Block a user