-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:ituk-ttu/ituk.ee
- Loading branch information
Showing
1 changed file
with
31 additions
and
19 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 |
---|---|---|
@@ -1,33 +1,45 @@ | ||
name: Build and Deploy | ||
name: Node.js CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
SSH_USERNAME: ${{ secrets.SSH_USERNAME }} | ||
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_RSA }} | ||
|
||
jobs: | ||
build-and-deploy: | ||
build: | ||
runs-on: self-hosted | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 17 | ||
|
||
- name: Install dependencies | ||
run: npm install --force | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '17' | ||
- name: Decrypt private key | ||
run: echo "$SSH_PRIVATE_KEY" | base64 -d > deploy_rsa | ||
env: | ||
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_RSA }} | ||
|
||
- name: Install dependencies | ||
run: npm install --force | ||
- name: Add SSH key | ||
uses: webfactory/ssh-agent@v0.5.0 | ||
with: | ||
ssh-private-key: ./deploy_rsa | ||
|
||
- name: Decrypt private key | ||
uses: webfactory/ssh-agent@v0.4.0 | ||
with: | ||
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }} | ||
ssh-keyname: deploy_rsa | ||
- name: Install rsync | ||
run: sudo apt-get install rsync | ||
|
||
- name: Build project | ||
run: npm run build -prod | ||
- name: Build project | ||
run: npm run build -prod | ||
|
||
- name: Deploy | ||
run: rsync -chavzP --rsh="ssh -l ${{ secrets.SSH_USERNAME }}" _work/ituk.ee/* ${{ secrets.SSH_USERNAME }}@ituk.ee:/var/ituk.ee/build | ||
- name: Deploy to server | ||
run: rsync -chavzP --rsh="ssh -l $SSH_USERNAME" _work/ituk.ee/* $SSH_USERNAME@ituk.ee:/var/ituk.ee/build |