Merge branch 'master' of github.com:ituk-ttu/ituk.ee #19
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
name: Node.js CI | |
on: | |
push: | |
branches: | |
- master | |
env: | |
SSH_USERNAME: ${{ secrets.SSH_USERNAME }} | |
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_RSA }} | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- 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: Decrypt private key | |
run: echo "$SSH_PRIVATE_KEY" | base64 -d > deploy_rsa | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_RSA }} | |
- name: Add SSH key | |
uses: webfactory/ssh-agent@v0.5.0 | |
with: | |
ssh-private-key: ./deploy_rsa | |
- name: Install rsync | |
run: sudo apt-get install rsync | |
- name: Build project | |
run: npm run build -prod | |
- name: Deploy to server | |
run: rsync -chavzP --rsh="ssh -l $SSH_USERNAME" _work/ituk.ee/* $SSH_USERNAME@ituk.ee:/var/ituk.ee/build |