-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make docker login to be configurable
- Loading branch information
1 parent
af20364
commit d23bacd
Showing
2 changed files
with
18 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,18 +3,18 @@ name: 'Scala SBT Action' | |
author: 'Matan Keidar <[email protected]>' | ||
description: 'SBT build tool action with docker' | ||
inputs: | ||
commands: # id of input | ||
command: # id of input | ||
description: 'Commands to run' | ||
required: true | ||
docker-login-username: # Docker login username | ||
description: 'docker login username' | ||
required: true | ||
required: false | ||
docker-login-password: # Docker login password | ||
description: 'docker login password' | ||
required: true | ||
required: false | ||
docker-registry: # Docker registry | ||
description: 'docker registry' | ||
required: true | ||
required: false | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
#!/bin/sh | ||
|
||
sbt version | ||
set -x | ||
COMMAND="" | ||
|
||
DOCKER_USERNAME=$1 | ||
DOCKER_PASSWORD=$2 | ||
DOCKER_REGISTRY=$3 | ||
if [[ -z ${1} || -z ${2} || -z ${3} ]]; then | ||
echo "One or more variables are not defined, will run command" | ||
COMMAND = $1 | ||
else | ||
DOCKER_USERNAME=$1 | ||
DOCKER_PASSWORD=$2 | ||
DOCKER_REGISTRY=$3 | ||
COMMAND=$4 | ||
echo "Running docker login into ${DOCKER_REGISTRY}" | ||
|
||
echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin ${DOCKER_REGISTRY} | ||
echo ${DOCKER_PASSWORD} | docker login -u ${DOCKER_USERNAME} --password-stdin ${DOCKER_REGISTRY} | ||
fi | ||
|
||
$4 | ||
echo "Running command" | ||
${COMMAND} | ||
|