-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Main Branch CI/CD Workflow | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
test: | ||
name: Testing | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: '.nvmrc' | ||
cache: yarn # caching npm dependencies | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Testing with Jest | ||
run: yarn test | ||
|
||
pull_deploy: | ||
name: Pull and Deploy | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Executing remote ssh commands using password | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.NCP_SERVER_IP }} | ||
username: ${{ secrets.NCP_SERVER_USER }} | ||
password: ${{ secrets.NCP_SERVER_PW }} | ||
port: ${{ secrets.NCP_SERVER_PORT }} | ||
script: | | ||
~/deploy.sh | ||
# TODO: change runs-on to self-hosted runner (or change NCP to AWS) |