-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
102 lines (90 loc) · 2.55 KB
/
action.yml
File metadata and controls
102 lines (90 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: 'EvenNode Deploy'
description: 'Deploy an application to EvenNode'
author: 'Rodny Estrada'
branding:
icon: 'upload-cloud'
color: 'purple'
inputs:
key:
description: 'SSH private key for deployment'
required: true
git_url:
description: 'EvenNode repository URL'
required: true
dot_env:
description: 'Content of .env file'
required: false
commit_message:
description: 'Custom commit message'
default: '[evennode production build]'
required: false
git_email:
description: 'Git email for push'
required: false
default: '41898282+github-actions[bot]@users.noreply.github.com'
git_name:
description: 'Git name for push'
required: false
default: 'github-actions[bot]'
branch:
description: 'Branch to push (default: main)'
required: false
default: main
pre_commit_command:
description: 'Command to run before committing changes'
required: false
pre_push_command:
description: 'Command to run before pushing to EvenNode'
required: false
runs:
using: 'composite'
steps:
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ inputs.key }}
known_hosts: ' '
- name: Add git.evennode.com to known_hosts
shell: bash
run: |
ssh-keyscan -H git.evennode.com > ~/.ssh/known_hosts
- name: Remove Git history for avoid 'shadow push error'
shell: bash
run: |
rm -rf .git
git init
git branch -m ${{ inputs.branch }}
git add .
- name: Set Git credentials
shell: bash
run: |
git config --global user.email "${{ inputs.git_email }}"
git config --global user.name "${{ inputs.git_name }}"
- name: Prepare .env file
shell: bash
if: inputs.dot_env
run: |
echo "${{ inputs.dot_env }}" > .env
git add .env -f
- name: Run pre-commit commands
shell: bash
if: inputs.pre_commit_command
run: |
${{ inputs.pre_commit_command }}
- name: Commit changes
shell: bash
run: |
git commit -m "${{ inputs.commit_message }}" || echo "No changes to commit"
- name: Add EvenNode remote
shell: bash
run: |
git remote add evennode "${{ inputs.git_url }}" || git remote set-url evennode "${{ inputs.git_url }}"
- name: Run pre-push commands
shell: bash
if: inputs.pre_push_command
run: |
${{ inputs.pre_push_command }}
- name: Push to EvenNode
shell: bash
run: |
git push evennode "${{ inputs.branch }}" -f