-
Notifications
You must be signed in to change notification settings - Fork 8
70 lines (59 loc) · 1.89 KB
/
deploy-nginx.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Deploy Nginx
on:
push:
branches:
- 'disabled-main'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
pull_request:
branches:
- 'disabled-main'
workflow_dispatch:
env:
PUBLIC_SITE_HOSTNAME: 'https://nemanjamitic.com'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Print commit id, message and tag
run: |
git show -s --format='%h %s'
echo "github.ref -> {{ github.ref }}"
- name: Set up Node.js and Yarn
uses: actions/setup-node@v3
with:
node-version: '20.10.0'
registry-url: 'https://registry.yarnpkg.com'
- name: Install dependencies
run: yarn install --frozen-lockfile
# fix this for turbo
- name: Build nemanjamiticcom
run: yarn build:nmc
- name: Clean up website dir
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
key: ${{ secrets.REMOTE_KEY_ED25519 }}
port: ${{ secrets.REMOTE_PORT }}
script_stop: true
script: whoami
# script: rm -rf /home/ubuntu/traefik-proxy/apps/nginx-with-volume-nmc/website/*
- name: Copy dist folder to remote host
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USERNAME }}
key: ${{ secrets.REMOTE_KEY_ED25519 }}
port: ${{ secrets.REMOTE_PORT }}
source: 'apps/nemanjamiticcom/dist/'
target: '/home/ubuntu/traefik-proxy/apps/nginx-with-volume-nmc/website'
# remove apps/nemanjamiticcom/dist path segments
strip_components: 3
# remove website dir
# not good, must restart nginx docker every time
# rm: true