Skip to content

Commit

Permalink
Add optional tag postfix function, remove DOCKER_TAG_FULL_REF
Browse files Browse the repository at this point in the history
  • Loading branch information
pangzineng committed Mar 15, 2019
1 parent a8179e8 commit 57753e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This Github Action does a fixed list of actions:
1. (optional) filter the branch for action
2. login to your Docker Registry
3. build your docker image
4. tag the image with `latest`, `sha` of the commit, `ref` of the commit, or with your own tag
5. push the image to your registry
4. tag the image with `latest`, `sha` of the commit, `ref` of the commit, or your own tag
5. push all tags of the image to your registry

Such that you don't have to run 5 different actions, which require the same environment setup (basically Docker) to be repeated again and again.

Expand All @@ -32,7 +32,7 @@ Below are the optional Secrets / Env:

Below are some additional optional env:

- `DOCKER_TAG_FULL_REF` - if this value is set, the `ref` tag of the image will contain the type of ref (git tag or git branch)
- `DOCKER_TAG_APPEND` - if this value is set, the default `ref` tag will be appended with this value (e.g. `DOCKER_TAG_APPEND=asia-business` for a git master branch push will produce this docker image tag: `master_asia-business`)


## Example
Expand Down
9 changes: 2 additions & 7 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,9 @@ then
fi

GIT_TAG=${ref_value//\//-} ## replace `/` with `-` in ref for docker tag requirement (master or 2019-03-13)
if [ -n "${DOCKER_TAG_FULL_REF+set}" ] ## if user specifically ask for differentiating tag & branch update
if [ -n "${DOCKER_TAG_APPEND+set}" ] ## right append to tag if specified
then
if [ "$ref_type" = "tags" ]
then
GIT_TAG=tag_$GIT_TAG
else
GIT_TAG=branch_$GIT_TAG
fi
GIT_TAG=${GIT_TAG}_${DOCKER_TAG_APPEND}
fi

REGISTRY=${DOCKER_REGISTRY_URL} ## use default Docker Hub as registry unless specified
Expand Down

0 comments on commit 57753e0

Please sign in to comment.