mirror of
https://github.com/cpina/github-action-push-to-another-repository.git
synced 2025-09-05 08:05:47 -06:00
Added functionality to be able to set and push git tag
This commit is contained in:
parent
ac0bb2c8f9
commit
6404b153ed
@ -48,6 +48,9 @@ inputs:
|
|||||||
description: '[Optional] The directory to wipe and replace in the target repository'
|
description: '[Optional] The directory to wipe and replace in the target repository'
|
||||||
default: ''
|
default: ''
|
||||||
required: false
|
required: false
|
||||||
|
commit-tag:
|
||||||
|
description: '[Optional] The tag that should be applied to the commit'
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: docker
|
using: docker
|
||||||
@ -64,6 +67,7 @@ runs:
|
|||||||
- '${{ inputs.target-branch }}'
|
- '${{ inputs.target-branch }}'
|
||||||
- '${{ inputs.commit-message }}'
|
- '${{ inputs.commit-message }}'
|
||||||
- '${{ inputs.target-directory }}'
|
- '${{ inputs.target-directory }}'
|
||||||
|
- '${{ inputs.commit-tag }}'
|
||||||
branding:
|
branding:
|
||||||
icon: git-commit
|
icon: git-commit
|
||||||
color: green
|
color: green
|
||||||
|
@ -15,6 +15,7 @@ DESTINATION_REPOSITORY_USERNAME="${8}"
|
|||||||
TARGET_BRANCH="${9}"
|
TARGET_BRANCH="${9}"
|
||||||
COMMIT_MESSAGE="${10}"
|
COMMIT_MESSAGE="${10}"
|
||||||
TARGET_DIRECTORY="${11}"
|
TARGET_DIRECTORY="${11}"
|
||||||
|
COMMIT_TAG="${12}"
|
||||||
|
|
||||||
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
if [ -z "$DESTINATION_REPOSITORY_USERNAME" ]
|
||||||
then
|
then
|
||||||
@ -118,3 +119,11 @@ git diff-index --quiet HEAD || git commit --message "$COMMIT_MESSAGE"
|
|||||||
echo "[+] Pushing git commit"
|
echo "[+] Pushing git commit"
|
||||||
# --set-upstream: sets de branch when pushing to a branch that does not exist
|
# --set-upstream: sets de branch when pushing to a branch that does not exist
|
||||||
git push "https://$USER_NAME:$API_TOKEN_GITHUB@$GITHUB_SERVER/$DESTINATION_REPOSITORY_USERNAME/$DESTINATION_REPOSITORY_NAME.git" --set-upstream "$TARGET_BRANCH"
|
git push "https://$USER_NAME:$API_TOKEN_GITHUB@$GITHUB_SERVER/$DESTINATION_REPOSITORY_USERNAME/$DESTINATION_REPOSITORY_NAME.git" --set-upstream "$TARGET_BRANCH"
|
||||||
|
|
||||||
|
# Tag commit and push
|
||||||
|
if [ -v "$COMMIT_TAG" ]
|
||||||
|
then
|
||||||
|
echo "[+] git tag"
|
||||||
|
git tag $COMMIT_TAG
|
||||||
|
git push "https://$USER_NAME:$API_TOKEN_GITHUB@$GITHUB_SERVER/$DESTINATION_REPOSITORY_USERNAME/$DESTINATION_REPOSITORY_NAME.git" --tags
|
||||||
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user