Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisSaarjoe committed May 14, 2023
1 parent ae42610 commit 9f3514c
Showing 1 changed file with 20 additions and 31 deletions.
51 changes: 20 additions & 31 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,33 @@
name: Deploy to ituk.ee
name: Build and Deploy

on:
push:
branches:
- master

jobs:
deploy:
build-and-deploy:
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 Node.js
uses: actions/setup-node@v2
with:
node-version: '17'
- name: Install dependencies
run: npm install --force

- name: Install dependencies
run: npm install --force

- name: Decrypt private key
uses: webfactory/ssh-agent@v0.4.0
with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
ssh-keyname: deploy_rsa

- name: Decrypt deploy key
run: |
openssl aes-256-cbc -K ${{ secrets.DEPLOY_KEY_K }} -iv ${{ secrets.DEPLOY_KEY_IV }} -in deploy_rsa.enc -out deploy_rsa -d
chmod 600 deploy_rsa
eval "$(ssh-agent -s)"
ssh-add deploy_rsa
- name: Build project
run: npm run build -prod

- name: Deploy to remote server
uses: easingthemes/ssh-deploy@v2
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
args: -chavzP
local-dir: _work/ituk.ee/*
remote-dir: /var/ituk.ee/build
ssh-host: ${{ secrets.SSH_HOST }}
ssh-username: ${{ secrets.SSH_USERNAME }}

- name: Build project
run: npm run build
- name: Deploy
run: rsync -chavzP --rsh="ssh -l ${{ secrets.SSH_USERNAME }}" _work/ituk.ee/* ${{ secrets.SSH_USERNAME }}@ituk.ee:/var/ituk.ee/build

0 comments on commit 9f3514c

Please sign in to comment.