mirror of
https://github.com/peter-evans/dockerhub-description.git
synced 2024-11-21 19:49:32 +01:00
add env compatibility with DOCKER_ prefixes
This commit is contained in:
parent
6ffdd6905f
commit
b93f6fad1d
3 changed files with 35 additions and 5 deletions
|
@ -18,9 +18,9 @@ This is useful if you `docker push` your images to Docker Hub. It provides an ea
|
|||
|
||||
#### Required environment variables
|
||||
|
||||
- `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>`. May also be passed as a secret if considered sensitive.
|
||||
- `DOCKERHUB_USERNAME` - Docker Hub username. If updating a Docker Hub repository belonging to an organization, this user must have `Admin` permissions for the repository. Aliases: `DOCKER_USERNAME`
|
||||
- `DOCKERHUB_PASSWORD` - Docker Hub password. Fallback to `DOCKER_PASSWORD` if set. Aliases: `DOCKER_PASSWORD`
|
||||
- `DOCKERHUB_REPOSITORY` - The Docker Hub repository to update in the format `<namespace>/<name>`. May also be passed as a secret if considered sensitive. Aliases: `DOCKER_REPOSITORY`, `GITHUB_REPOSITORY`
|
||||
|
||||
**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.
|
||||
|
||||
|
|
12
action.yml
12
action.yml
|
@ -5,5 +5,15 @@ runs:
|
|||
using: 'docker'
|
||||
image: 'docker://peterevans/dockerhub-description:2.1.1'
|
||||
branding:
|
||||
icon: 'upload'
|
||||
icon: 'upload'
|
||||
color: 'blue'
|
||||
inputs:
|
||||
dockerhubUsername:
|
||||
description: Username to login to Docker Hub. Aliases: DOCKER_USERNAME
|
||||
required: false
|
||||
dockerhubPassword:
|
||||
description: Password to login to Docker Hub. Aliases: DOCKER_PASSWORD
|
||||
required: false
|
||||
dockerhubRepository:
|
||||
description: Explicit Docker Hub repository name. Aliases: DOCKER_REPOSITORY, GITHUB_REPOSITORY
|
||||
required: false
|
||||
|
|
|
@ -1,7 +1,27 @@
|
|||
#!/bin/sh -l
|
||||
set -euo pipefail
|
||||
set -eo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
# Allow DOCKERHUB_* variables to be set from their DOCKER_* variant
|
||||
DOCKERHUB_USERNAME=${DOCKERHUB_USERNAME:-${DOCKER_USERNAME}}
|
||||
DOCKERHUB_PASSWORD=${DOCKERHUB_PASSWORD:-${DOCKER_PASSWORD}}
|
||||
DOCKERHUB_REPOSITORY=${DOCKERHUB_REPOSITORY:-${DOCKER_REPOSITORY}}
|
||||
|
||||
# If the repository isn't explicitly defined, infer it from GitHub if possible
|
||||
DOCKERHUB_REPOSITORY=${DOCKERHUB_REPOSITORY:-${GITHUB_REPOSITORY}}
|
||||
|
||||
# Validate we can authenticate
|
||||
if [ -z "$DOCKERHUB_USERNAME" ] || [ -z "$DOCKERHUB_PASSWORD" ]; then
|
||||
echo 'Unable to authenticate with Docker Hub, set a valid $DOCKERHUB_USERNAME and $DOCKERHUB_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Validate we have the repository name
|
||||
if [ -z "$DOCKERHUB_REPOSITORY" ]; then
|
||||
echo 'Unable to determine Docker Hub repository name, set with $DOCKERHUB_REPOSITORY'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set the default path to README.md
|
||||
README_FILEPATH=${README_FILEPATH:="./README.md"}
|
||||
|
||||
|
|
Loading…
Reference in a new issue