-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (72 loc) · 2.63 KB
/
front.yaml
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
# This is a basic workflow to help you get started with Actions
name: CI/CD For the Frontend
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
paths:
- "front/**"
- .github/workflows/front.yaml
- ./pnpm-lock.yaml
branches:
- main
# Allows you to run this workflow manually from the Actions tab+1
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
runs-on: ubuntu-latest
environment: prod
steps:
- uses: actions/checkout@v2
- name: Setup pnpm
uses: pnpm/action-setup@646cdf48217256a3d0b80361c5a50727664284f2
with:
version: 7.1.0
- name: Setup Node version
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: "pnpm"
- name: Install dependencies
run: FORCE_COLOR=true pnpm install --frozen-lockfile --prefix front
- name: Build the frontend
run: |
FORCE_COLOR=true pnpm run --prefix shared build
NODE_ENV=production VITE_WS_URL=kiss-cam.live VITE_SUPABASE_URL=$SUPABASE_URL VITE_SUPABASE_ANON_KEY=$SUPABASE_ANON_KEY VITE_STRIPE_PUBLIC_KEY=$STRIPE_PUBLIC_KEY FORCE_COLOR=true pnpm run --prefix front build
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
STRIPE_PUBLIC_KEY: ${{ secrets.STRIPE_PUBLIC_KEY }}
- name: Cache Build Output
uses: actions/upload-artifact@v2
with:
name: kisscam-front-build-output
path: front/dist
deploy:
# The type of runner that the job will run on
needs:
- build
runs-on: ubuntu-latest
environment: prod
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- name: Download Build Artifact
uses: actions/download-artifact@v2
with:
name: kisscam-front-build-output
path: dist
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_SERVER_KEY }}
name: id_rsa # optional
known_hosts: ${{ secrets.KNOWN_HOSTS }}
- name: Deploy to Server
run: rsync -arvzP -e "ssh -p $DEPLOY_PORT" ./dist/ $DEPLOY_USER@$DEPLOY_DOMAIN:$DEPLOY_DIR/front
env:
DEPLOY_DIR: ${{ secrets.DEPLOY_DIR }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
DEPLOY_DOMAIN: ${{ secrets.DEPLOY_DOMAIN }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}