Skip to content

Commit

Permalink
Merge pull request #17 from anothrNick/output-tag
Browse files Browse the repository at this point in the history
Create action.yml metadata. Set new tag to output for other builds.
  • Loading branch information
anothrNick committed Oct 14, 2019
2 parents b326202 + a5aef50 commit f9e1720
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Dockerfile
@@ -1,9 +1,4 @@
FROM alpine
LABEL "com.github.actions.name"="Github Tag Bump"
LABEL "com.github.actions.description"="Bump and push git tag on merge"
LABEL "com.github.actions.icon"="git-merge"
LABEL "com.github.actions.color"="purple"

LABEL "repository"="https://github.com/anothrNick/github-tag-action"
LABEL "homepage"="https://github.com/anothrNick/github-tag-action"
LABEL "maintainer"="Nick Sjostrom"
Expand Down
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -31,10 +31,16 @@ jobs:

#### Options

**Environment Variables**

* **GITHUB_TOKEN** ***(required)*** - Required for permission to tag the repo.
* **DEFAULT_BUMP** *(optional)* - Which type of bump to use when none explicitly provided (default: `minor`).
* **WITH_V** *(optional)* - Tag version with `v` character.

#### Outputs

* **new_tag** - The value of the newly created tag.

> ***Note:*** This action creates a [lightweight tag](https://developer.github.com/v3/git/refs/#create-a-reference).
### Bumping
Expand Down
12 changes: 12 additions & 0 deletions action.yml
@@ -0,0 +1,12 @@
name: 'Github Tag Bump'
description: 'Bump and push git tag on merge'
author: 'Nick Sjostrom'
runs:
using: 'docker'
image: 'Dockerfile'
outputs:
new_tag:
description: 'Generated tag'
branding:
icon: 'git-merge'
color: 'purple'
5 changes: 5 additions & 0 deletions entrypoint.sh
Expand Up @@ -34,13 +34,18 @@ case "$log" in
* ) new=$(semver bump `echo $default_semvar_bump` $tag);;
esac

# prefix with 'v'
if $with_v
then
new="v$new"
fi

echo $new

# set output
echo ::set-output name=new_tag::$new

# push new tag ref to github
dt=$(date '+%Y-%m-%dT%H:%M:%SZ')
full_name=$GITHUB_REPOSITORY
git_refs_url=$(jq .repository.git_refs_url $GITHUB_EVENT_PATH | tr -d '"' | sed 's/{\/sha}//g')
Expand Down

0 comments on commit f9e1720

Please sign in to comment.