Skip to content

Commit

Permalink
LDBR-4.10: Автодеплой (#47)
Browse files Browse the repository at this point in the history
* LDBR-4.10: Добавить автодеплой в CI.

* LDBR-4.10: Исправить загрузку файлов на сервер.

* LDBR-4.10: Исправить директорию на тачке.

* LDBR-4.10: Сделать деплой только для main.
  • Loading branch information
DPeshkoff authored Dec 15, 2021
1 parent cceb898 commit 20d6736
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: CI

on:
push:
branches: [ '**' ]
pull_request:
branches: [ '**' ]
branches:
- main

jobs:
build:
Expand All @@ -18,7 +17,21 @@ jobs:
with:
node-version: 16.x
cache: 'npm'

- name: Install modules
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Build
run: npm run build

- name: Copy SW
run: cp src/sw.js dist/

- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: ./dist
59 changes: 59 additions & 0 deletions .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy

on:
push:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'npm'

- name: Install modules
run: npm ci

- name: Run ESLint
run: npm run lint

- name: Build
run: npm run build

- name: Copy SW
run: cp src/sw.js dist/

- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: dist
path: ./dist

deploy:
runs-on: ubuntu-latest

needs: build

steps:
- name: Download build
uses: actions/download-artifact@v2
with:
name: dist
path: dist

- name: Transfer build files to server
uses: appleboy/scp-action@master
with:
host: 95.163.213.142
username: ubuntu
key: ${{ secrets.PRIVATE_KEY }}
source: "dist/*"
target: "/home/ubuntu/01-frontend/"

0 comments on commit 20d6736

Please sign in to comment.