Skip to content

Commit ecccbd0

Browse files
committed
1 parent 07c4d7b commit ecccbd0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

action.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Push directory to another repository
1+
name: Push directory to another repository and create a named tag
22
description: >-
33
Useful to push files to another repository to be used, for example, via github
44
pages
@@ -48,6 +48,10 @@ inputs:
4848
description: '[Optional] The directory to wipe and replace in the target repository'
4949
default: ''
5050
required: false
51+
tag-name:
52+
description: '[Optional] Add a tag to the commit'
53+
default: ''
54+
required: false
5155
create-target-branch-if-needed:
5256
type: boolean
5357
description: >-
@@ -71,6 +75,7 @@ runs:
7175
- '${{ inputs.commit-message }}'
7276
- '${{ inputs.target-directory }}'
7377
- '${{ inputs.create-target-branch-if-needed }}'
78+
- '${{ inputs.tag-name }}'
7479
branding:
7580
icon: git-commit
7681
color: green

entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ TARGET_BRANCH="${9}"
1616
COMMIT_MESSAGE="${10}"
1717
TARGET_DIRECTORY="${11}"
1818
CREATE_TARGET_BRANCH_IF_NEEDED="${12}"
19+
TAG_NAME="${13}"
1920

2021
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
2122
then
@@ -170,6 +171,12 @@ echo "[+] git diff-index:"
170171
# git diff-index : to avoid doing the git commit failing if there are no changes to be commit
171172
git diff-index --quiet HEAD || git commit --message "$COMMIT_MESSAGE"
172173

174+
if [ -n "${TAG_NAME}" ]
175+
then
176+
git tag -a $TAG_NAME -m ""
177+
git config --global push.followTags true
178+
fi
179+
173180
echo "[+] Pushing git commit"
174181
# --set-upstream: sets de branch when pushing to a branch that does not exist
175182
git push "$GIT_CMD_REPOSITORY" --set-upstream "$TARGET_BRANCH"

0 commit comments

Comments
 (0)