-
Notifications
You must be signed in to change notification settings - Fork 1
38 lines (35 loc) · 1.4 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: deploy
on:
push:
branches: '*'
jobs:
deplou:
runs-on: ubuntu-latest
steps:
- name: Get repo
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: latest
cache: 'npm'
- name: Installation project s packages
run: npm i
- name: build project
run: npm run build
- name: Add ssh keys
run: |
mkdir ~/.ssh
echo {{ secrets.PRIVATE }} > ~/.ssh/id_rsa
echo {{ secrets.PUBLIC }} > ~/.ssh/id_rsa.pub
- name: Copy file on server
run: scp -o StrictHostKeyChecking=no -r ./.output ${{ secrets.USERNAME }}@${{ secrets.HOST }}:~
- name: Copy docker files on server
run: |
scp -o StrictHostKeyChecking=no Dockerfile compose.yaml ${{ secrets.USERNAME }}@${{ secrets.HOST }}:~
- name: RUN on server
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} "echo ${{ secrets.PASS }}| sudo -S docker compose -f \"compose.yaml\" up -d --build"
ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} "rm -rf ~/.output"
ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} "rm Dockerfile"
ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} "rm compose.yaml"