Skip to content

Commit 297780c

Browse files
authored
Merge pull request #268 from AMTuttle02/prod
Create deploy.yml
2 parents 5a8b4d0 + 6fd57cc commit 297780c

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Deploy to Hostinger
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: Build with Vite
25+
run: npm run build
26+
27+
- name: Upload Artifacts
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: deploy-files
31+
path: |
32+
./dist
33+
./api # Assuming your API folder is in the root of your repo
34+
35+
deploy:
36+
needs: build
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Download Artifacts
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: deploy-files
44+
45+
- name: Deploy to Hostinger via SFTP
46+
uses: burnett01/rsync-deployments@5.2
47+
with:
48+
committer_name: GitHub Actions
49+
committer_email: actions@github.com
50+
args: -avz --delete
51+
ssh_key: ${{ secrets.HOSTINGER_PRIVATE_KEY }}
52+
remote_host: ${{ secrets.HOSTINGER_HOST }}
53+
remote_user: ${{ secrets.HOSTINGER_USER }}
54+
remote_path: ${{ secrets.HOSTINGER_REMOTE_PATH }}
55+
56+
- name: Move API Folder
57+
uses: appleboy/ssh-action@v1
58+
with:
59+
host: ${{ secrets.HOSTINGER_HOST }}
60+
username: ${{ secrets.HOSTINGER_USER }}
61+
key: ${{ secrets.HOSTINGER_PRIVATE_KEY }}
62+
script: |
63+
mv ${{ secrets.HOSTINGER_REMOTE_PATH }}/API ${{ secrets.HOSTINGER_REMOTE_PATH }}/API # replace api_folder_name

0 commit comments

Comments
 (0)