Skip to content

Commit 802d27a

Browse files
committed
feat(action): enhance EvenNode deployment with git reset and defaults
- Add step to remove git history for clean deployment - Set default values for git credentials and branch - Simplify .env file creation logic - Improve error prevention with fresh git init
1 parent 9e15641 commit 802d27a

1 file changed

Lines changed: 38 additions & 28 deletions

File tree

action.yml

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,66 @@
1-
name: "EvenNode Deploy"
2-
description: "Deploy an application to EvenNode"
3-
author: "Rodny Estrada"
1+
name: 'EvenNode Deploy'
2+
description: 'Deploy an application to EvenNode'
3+
author: 'Rodny Estrada'
44

55
branding:
6-
icon: "upload-cloud"
7-
color: "purple"
6+
icon: 'upload-cloud'
7+
color: 'purple'
88

99
inputs:
1010
key:
11-
description: "SSH private key for deployment"
12-
required: true
13-
git_email:
14-
description: "Git email for commit"
15-
required: true
16-
git_name:
17-
description: "Git name for commit"
11+
description: 'SSH private key for deployment'
1812
required: true
1913
git_url:
20-
description: "EvenNode repository URL"
14+
description: 'EvenNode repository URL'
2115
required: true
2216
dot_env:
23-
description: "Content of .env file"
17+
description: 'Content of .env file'
2418
required: false
2519
commit_message:
26-
description: "Custom commit message"
20+
description: 'Custom commit message'
21+
default: '[evennode production build]'
22+
required: false
23+
git_email:
24+
description: 'Git email for push'
25+
required: false
26+
default: '41898282+github-actions[bot]@users.noreply.github.com'
27+
git_name:
28+
description: 'Git name for push'
2729
required: false
30+
default: 'github-actions[bot]'
2831
branch:
29-
description: "Branch to push to"
32+
description: 'Branch to push (default: main)'
3033
required: false
34+
default: main
3135
pre_commit_command:
32-
description: "Command to run before committing changes"
36+
description: 'Command to run before committing changes'
3337
required: false
3438
pre_push_command:
35-
description: "Command to run before pushing to EvenNode"
39+
description: 'Command to run before pushing to EvenNode'
3640
required: false
3741

3842
runs:
39-
using: "composite"
43+
using: 'composite'
4044
steps:
4145
- name: Install SSH key
4246
uses: shimataro/ssh-key-action@v2
4347
with:
4448
key: ${{ inputs.key }}
45-
known_hosts: " "
49+
known_hosts: ' '
4650

4751
- name: Add git.evennode.com to known_hosts
4852
shell: bash
4953
run: |
5054
ssh-keyscan -H git.evennode.com > ~/.ssh/known_hosts
51-
55+
56+
- name: Remove Git history for avoid 'shadow push error'
57+
shell: bash
58+
run: |
59+
rm -rf .git
60+
git init
61+
git branch -m ${{ inputs.branch }}
62+
git add .
63+
5264
- name: Set Git credentials
5365
shell: bash
5466
run: |
@@ -57,12 +69,10 @@ runs:
5769
5870
- name: Prepare .env file
5971
shell: bash
60-
run: |
61-
if [ -n "${{ inputs.dot_env }}" ]; then
62-
echo "${{ inputs.dot_env }}" > .env
63-
git add .env -f
64-
fi
6572
if: inputs.dot_env
73+
run: |
74+
echo "${{ inputs.dot_env }}" > .env
75+
git add .env -f
6676
6777
- name: Run pre-commit commands
6878
shell: bash
@@ -73,7 +83,7 @@ runs:
7383
- name: Commit changes
7484
shell: bash
7585
run: |
76-
git commit -m "${{ inputs.commit_message || '[evennode production build]' }}" || echo "No changes to commit"
86+
git commit -m "${{ inputs.commit_message }}" || echo "No changes to commit"
7787
7888
- name: Add EvenNode remote
7989
shell: bash
@@ -89,4 +99,4 @@ runs:
8999
- name: Push to EvenNode
90100
shell: bash
91101
run: |
92-
git push evennode "${{ inputs.branch || 'main' }}" -f
102+
git push evennode "${{ inputs.branch }}" -f

0 commit comments

Comments
 (0)