Skip to content

Commit

Permalink
Add CD with caprover deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
s-h-a-d-o-w committed Nov 7, 2024
1 parent 3992bc8 commit ab3db3a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Deployment

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install, test, deploy
run: |
pnpm install --frozen-lockfile
pnpm test
sh deploy.sh
env:
CAPROVER_PASSWORD: ${{ secrets.CAPROVER_PASSWORD }}
CAPROVER_MACHINE_01: ${{ secrets.CAPROVER_MACHINE_01 }}
CAPROVER_MACHINE_02: ${{ secrets.CAPROVER_MACHINE_02 }}
CI: true
15 changes: 8 additions & 7 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@

#!/bin/bash
set -e

export CAPROVER_APP=simple-chatgpt
export CAPROVER_APP=next-simple-chatgpt
export CAPROVER_TAR_FILE=./caprover_deployment.tar
set -a
source .env.local
set +a
if [ -f .env.local ]; then
set -a
source .env.local
set +a
fi

pnpm build

Expand All @@ -15,10 +16,10 @@ tar --exclude='.next/cache' -cf ./caprover_deployment.tar Dockerfile .next packa

echo "Deploying to machine 01..."
export CAPROVER_URL=$CAPROVER_MACHINE_01
caprover deploy > /dev/null
npx caprover deploy > /dev/null

echo "Deploying to machine 02..."
export CAPROVER_URL=$CAPROVER_MACHINE_02
caprover deploy > /dev/null
npx caprover deploy > /dev/null

rm caprover_deployment.tar

0 comments on commit ab3db3a

Please sign in to comment.