Skip to content

Commit c61b317

Browse files
authored
Merge pull request #30 from ToMe25/master
Add tagging support
2 parents 0e98be5 + 22cdfa3 commit c61b317

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ Add a step like this to your workflow:
4444
# Default: ''
4545
remove: "./dir/old_file.js"
4646

47+
# Name of the tag to add to the new commit. Use an empty string to disable tagging.
48+
# Default: ''
49+
tag: "v1.0.0"
50+
4751
env:
4852
# This is necessary in order to push a commit to the repo
4953
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ inputs:
3131
description: Arguments for the git rm command
3232
required: false
3333
default: ""
34+
tag:
35+
description: The name of the tag to add to the new commit
36+
required: false
37+
default: ""
3438

3539
runs:
3640
using: node12

lib/entrypoint.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ remove() {
3131
if [ -n "$INPUT_REMOVE" ]; then git rm $INPUT_REMOVE; fi
3232
}
3333

34+
tag() {
35+
if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi
36+
}
37+
3438
# This is needed to make the check work for untracked files
3539
echo "Staging files..."
3640
add
@@ -68,8 +72,11 @@ if ! git diff --cached --quiet --exit-code; then
6872
echo "Creating commit..."
6973
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
7074

75+
echo "Tagging commit..."
76+
tag
77+
7178
echo "Pushing to repo..."
72-
git push --set-upstream origin "$INPUT_REF"
79+
git push --set-upstream origin "$INPUT_REF" --tags
7380

7481
echo "::endgroup::"
7582
echo "Task completed."

src/entrypoint.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ remove() {
3131
if [ -n "$INPUT_REMOVE" ]; then git rm $INPUT_REMOVE; fi
3232
}
3333

34+
tag() {
35+
if [ -n "$INPUT_TAG" ]; then git tag $INPUT_TAG; fi
36+
}
37+
3438
# This is needed to make the check work for untracked files
3539
echo "Staging files..."
3640
add
@@ -68,8 +72,11 @@ if ! git diff --cached --quiet --exit-code; then
6872
echo "Creating commit..."
6973
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
7074

75+
echo "Tagging commit..."
76+
tag
77+
7178
echo "Pushing to repo..."
72-
git push --set-upstream origin "$INPUT_REF"
79+
git push --set-upstream origin "$INPUT_REF" --tags
7380

7481
echo "::endgroup::"
7582
echo "Task completed."

0 commit comments

Comments
 (0)