Skip to content

Commit 07d1d78

Browse files
committed
Update deploy-development.yml using github-hosted runner and SSH
1 parent ea316a8 commit 07d1d78

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

.github/workflows/deploy-development.yml

+25-18
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,42 @@
1-
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
41
name: Deploy development server to ec2
52

63
on:
74
push:
85
branches:
9-
- dev
6+
# - dev
7+
- refact/issue-533
108

119
jobs:
12-
build:
13-
runs-on: self-hosted
10+
deploy:
11+
runs-on: ubuntu-latest
12+
1413
strategy:
1514
matrix:
1615
node-version: [16.x]
17-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
18-
defaults:
19-
run:
20-
working-directory: ${{ env.SERVER_PROFILE }}
16+
2117
steps:
22-
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 #v3.1.0
23-
with:
24-
path: ${{ env.SERVER_PROFILE }}
18+
- name: Checkout Repository
19+
uses: actions/checkout@v3
20+
2521
- name: Use Node.js ${{ matrix.node-version }}
26-
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 #v.3.5.1
22+
uses: actions/setup-node@v3
2723
with:
2824
node-version: ${{ matrix.node-version }}
29-
- run: cp ~/config-injection/ecosystem-${{ env.SERVER_PROFILE }}.json ${{ env.PROJECT_PATH }}/ecosystem.json
30-
- run: cp ~/config-injection/envs/.env.${{ env.NODE_ENV }} ${{ env.PROJECT_PATH }}/.env
31-
- run: bash ${{ env.PROJECT_PATH }}/script/prebuild.sh
32-
- run: sh ${{ env.PROJECT_PATH }}/script/reload.sh
25+
26+
- name: Deploy to EC2 using SSH
27+
uses: appleboy/ssh-action@master
28+
with:
29+
host: ${{ secrets.SERVER_HOST }}
30+
username: ${{ secrets.SSH_USERNAME }}
31+
key: ${{ secrets.SSH_PRIVATE_KEY }}
32+
port: 22
33+
script: |
34+
cp ~/config-injection/ecosystem-${{ env.SERVER_PROFILE }}.json ${{ env.PROJECT_PATH }}/ecosystem.json
35+
cp ~/config-injection/envs/.env.${{ env.NODE_ENV }} ${{ env.PROJECT_PATH }}/.env
36+
cd ${{ env.PROJECT_PATH }}
37+
bash script/prebuild.sh
38+
sh script/reload.sh
39+
3340
env:
3441
NODE_ENV: development
3542
SERVER_PROFILE: development

0 commit comments

Comments
 (0)