Sign inSign up

thomaslacaze/dockerhub-description

By thomaslacaze

•Updated over 5 years ago

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

Image
0

928

thomaslacaze/dockerhub-description repository overview

⁠Docker Hub Description comptatible with Drone.io !

GitHub Marketplace

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: thomaslacaze/[email protected]
      with:
        username: ${{ secrets.PLUGIN_USERNAME }}
        password: ${{ secrets.PLUGIN_PASSWORD }}
        repository: thomaslacaze/dockerhub-description
⁠Action inputs

Note: Docker Hub Personal Access Tokens⁠ cannot be used as they are not supported by the API. See here⁠ and here⁠ for further details. Unfortunately, this means that enabling 2FA on Docker Hub will prevent the action from working.

NameDescriptionDefault
username(required) Docker Hub username. If updating a Docker Hub repository belonging to an organization, this user must have Admin permissions for the repository.
password(required) Docker Hub password.
repositoryDocker Hub repository in the format <namespace>/<name>.github.repository
short-descriptionDocker Hub repository short description. Input exceeding 100 characters will be truncated.
readme-filepathPath to the repository readme../README.md
⁠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 specified with the readme-filepath input.

    - name: Docker Hub Description
      uses: thomaslacaze/[email protected]
      with:
        username: ${{ secrets.PLUGIN_USERNAME }}
        password: ${{ secrets.PLUGIN_PASSWORD }}
        repository: thomaslacaze/dockerhub-description
        readme-filepath: ./path/to/README.md
⁠Examples

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.

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/[email protected]

    - name: Docker Hub Description
      uses: thomaslacaze/[email protected]
      with:
        username: ${{ secrets.PLUGIN_USERNAME }}
        password: ${{ secrets.PLUGIN_PASSWORD }}
        repository: thomaslacaze/dockerhub-description

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

name: Update Docker Hub Description
on: release
jobs:
  dockerHubDescription:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/[email protected]

    - name: Docker Hub Description
      uses: thomaslacaze/[email protected]
      with:
        username: ${{ secrets.PLUGIN_USERNAME }}
        password: ${{ secrets.PLUGIN_PASSWORD }}
        repository: thomaslacaze/dockerhub-description

⁠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 PLUGIN_USERNAME='user1' \
  -e PLUGIN_PASSWORD='xxxxx' \
  -e PLUGIN_REPOSITORY='user1/my-docker-image' \
  -e PLUGIN_README='/workspace/README.md' \
  thomaslacaze/dockerhub-description:2.4.1

⁠Using the Docker image with drone

- name: publish readme
  image: thomaslacaze/dockerhub-description:2.4.1
  settings:
    repository: thomaslacaze/dockerhub-description
    username:
      from_secret: docker_username
    password:
      from_secret: docker_password
    readme: /drone/src/README.md

⁠License

MIT⁠

Tag summary

Content type

Image

Digest

Size

38.9 MB

Last updated

over 5 years ago

docker pull thomaslacaze/dockerhub-description