|
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 |
| - |
4 | 1 | name: Deploy development server to ec2
|
5 | 2 |
|
6 | 3 | on:
|
7 | 4 | push:
|
8 | 5 | branches:
|
9 |
| - - dev |
| 6 | + # - dev |
| 7 | + - refact/issue-533 |
10 | 8 |
|
11 | 9 | jobs:
|
12 |
| - build: |
13 |
| - runs-on: self-hosted |
| 10 | + deploy: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
14 | 13 | strategy:
|
15 | 14 | matrix:
|
16 | 15 | 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 | + |
21 | 17 | 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 | + |
25 | 21 | - name: Use Node.js ${{ matrix.node-version }}
|
26 |
| - uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 #v.3.5.1 |
| 22 | + uses: actions/setup-node@v3 |
27 | 23 | with:
|
28 | 24 | 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 | +
|
33 | 40 | env:
|
34 | 41 | NODE_ENV: development
|
35 | 42 | SERVER_PROFILE: development
|
|
0 commit comments