Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ituk-ttu/ituk.ee
Browse files Browse the repository at this point in the history
  • Loading branch information
Tõnis Saarjõe committed May 14, 2023
2 parents 67f5548 + 8319f5a commit 1448b80
Showing 1 changed file with 31 additions and 19 deletions.
50 changes: 31 additions & 19 deletions .github/workflows/main.yml
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

0 comments on commit 1448b80

Please sign in to comment.