Skip to content

Commit

Permalink
Add tagging support
Browse files Browse the repository at this point in the history
  • Loading branch information
ToMe25 committed May 16, 2020
1 parent 0e98be5 commit 6b705fa
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Add a step like this to your workflow:
# Default: ''
remove: "./dir/old_file.js"

# Name of the tag to add to the new commit. Use an empty string to disable tagging.
# Default: ''
tag: "v1.0.0"

env:
# This is necessary in order to push a commit to the repo
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ inputs:
description: Arguments for the git rm command
required: false
default: ""
tag:
description: The name of the tag to add to the new commit
required: false
default: ""

runs:
using: node12
Expand Down
7 changes: 7 additions & 0 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ remove() {
if [ -n "$INPUT_REMOVE" ]; then git rm $INPUT_REMOVE; fi
}

tag() {
if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi
}

# This is needed to make the check work for untracked files
echo "Staging files..."
add
Expand Down Expand Up @@ -68,6 +72,9 @@ if ! git diff --cached --quiet --exit-code; then
echo "Creating commit..."
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"

echo "Tagging commit..."
tag

echo "Pushing to repo..."
git push --set-upstream origin "$INPUT_REF"

Expand Down

0 comments on commit 6b705fa

Please sign in to comment.