-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (83 loc) · 2.15 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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Build and Deploy
concurrency:
group: production
cancel-in-progress: true
on:
push:
branches:
- main
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node & Pnpm
uses: pnpm/action-setup@v2
with:
version: 8.14.1
- uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'pnpm'
- name: Create env file
run: |
echo "${{ secrets.ENV_FILE }}" > .env
echo "${{ secrets.ENV_LOCAL_FILE }}" > .env.local
- name: Install Deps
run: pnpm i
- name: Build
run: pnpm run build
- name: Build Storybook
run: pnpm run build.storybook
- name: Upload Landing Page Files
uses: actions/upload-artifact@v3
with:
name: landing-page
path: out
retention-days: 1
- name: Upload Storybook Files
uses: actions/upload-artifact@v3
with:
name: storybook
path: storybook-static
retention-days: 1
deploy:
name: Deploy
runs-on: self-hosted
needs: build
environment:
name: production
url: https://rafer.dev
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Storybook
uses: actions/download-artifact@v3
with:
name: storybook
path: storybook-static
- name: Download Landing Page
uses: actions/download-artifact@v3
with:
name: landing-page
path: out
- name: Filter
uses: dorny/[email protected]
id: filter
with:
filters: |
ngnix:
- '**/*'
- name: Deploy Nginx
if: ${{ steps.filter.outputs.ngnix }} == 'true'
run: |
sudo docker compose -f docker-compose.yaml build --no-cache
sudo docker compose down
sudo docker compose up -d
- name: Update content
run: |
sudo docker cp ./out server:/www/data/
sudo docker cp ./storybook-static server:/www/data/