A GitHub action to update a Docker Hub repository description from README.md https://github.com/peter-evans/dockerhub-description.git
Find a file
2019-08-12 17:30:59 +09:00
.circleci Add circleci config 2019-06-30 10:56:03 +09:00
.github/workflows Update workflow 2019-08-12 17:30:59 +09:00
Dockerfile Update base image 2019-06-29 11:08:25 +09:00
entrypoint.sh Remove duplicate flag 2019-07-07 16:19:29 +09:00
LICENSE Initial commit 2019-06-25 19:19:47 +09:00
README.md Update README 2019-08-12 14:18:43 +09:00

Docker Hub Description

GitHub Marketplace CircleCI

A GitHub action to update a Docker Hub repository description from README.md.

This is useful if you docker push your images to Docker Hub. It provides an easy, automated way to keep your Docker Hub repository description in sync with your GitHub repository README.md file.

Usage

    - name: Docker Hub Description
      uses: peter-evans/dockerhub-description@v1.0.1
      env:
        DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
        DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
        DOCKERHUB_REPOSITORY: ${{ secrets.DOCKERHUB_REPOSITORY }}

Required secrets

  • DOCKERHUB_USERNAME - Docker Hub username
  • DOCKERHUB_PASSWORD - Docker Hub password
  • DOCKERHUB_REPOSITORY - The name of the Docker Hub repository to update. The action combines this with the username to locate the repository. i.e. username/repository

Note that DOCKERHUB_USERNAME and DOCKERHUB_REPOSITORY may also be environment variables if not considered sensitive.

Optionally specifying the file path

The action assumes that there is a file called README.md located at the root of the repository. If this is not the case, the path can be overridden with an environment variable.

    - name: Docker Hub Description
      uses: peter-evans/dockerhub-description@v1.0.1
      env:
        DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
        DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
        DOCKERHUB_REPOSITORY: ${{ secrets.DOCKERHUB_REPOSITORY }}
        README_FILEPATH: ./some-path/README.md

Examples

Updates the Docker Hub repository description whenever there is a git push to the master branch.

on: push
name: Update Docker Hub Description
jobs:
  dockerHubDescription:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Filter master branch
      uses: actions/bin/filter@master
      with:
        args: branch master
    - name: Docker Hub Description
      uses: peter-evans/dockerhub-description@v1.0.1
      env:
        DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
        DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
        DOCKERHUB_REPOSITORY: ${{ secrets.DOCKERHUB_REPOSITORY }}

Updates the Docker Hub repository description whenever a new release is created.

on: release
name: Update Docker Hub Description
jobs:
  dockerHubDescription:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Docker Hub Description
      uses: peter-evans/dockerhub-description@v1.0.1
      env:
        DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
        DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
        DOCKERHUB_REPOSITORY: ${{ secrets.DOCKERHUB_REPOSITORY }}

Using the Docker image independently of GitHub Actions

The image can be executed in other environments independently of GitHub Actions. Simply volume mount the location of the README.md file to the container and set environment variables as follows.

docker run -v $PWD:/workspace \
  -e DOCKERHUB_USERNAME='user1' \
  -e DOCKERHUB_PASSWORD='xxxxx' \
  -e DOCKERHUB_REPOSITORY='my-docker-image' \
  -e README_FILEPATH='/workspace/README.md' \
  peterevans/dockerhub-description:1.0.1

License

MIT License - see the LICENSE file for details