aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/deploy.yml
diff options
context:
space:
mode:
authorFactiven <[email protected]>2023-09-24 10:38:13 +0700
committerGitHub <[email protected]>2023-09-24 10:38:13 +0700
commitc1dd18a01a0e8c2fc38328e590df7fca2a9dd168 (patch)
tree97991eef4868816b9b67ebce0ec5909ba3f9b7a5 /.github/workflows/deploy.yml
parentUpdate v4.0.6 (diff)
downloadmoopa-c1dd18a01a0e8c2fc38328e590df7fca2a9dd168.tar.xz
moopa-c1dd18a01a0e8c2fc38328e590df7fca2a9dd168.zip
Create deploy.yml
Diffstat (limited to '.github/workflows/deploy.yml')
-rw-r--r--.github/workflows/deploy.yml53
1 files changed, 53 insertions, 0 deletions
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000..f70651e
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,53 @@
+name: Deploy App
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - main
+
+jobs:
+ create-release:
+ runs-on: self-hosted
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Set up Node.js
+ uses: actions/setup-node@v2
+ with:
+ node-version: 18
+
+ - name: Install dependencies
+ run: bun install
+
+ - name: Generate Prisma
+ run: bunx prisma generate || exit
+
+ - name: Build the project
+ run: BUILD_DIR=temp bun run build || exit
+
+ - name: Check if temp directory exists
+ run: |
+ if [ ! -d "temp" ]; then
+ echo '\033[31m temp Directory not exists!\033[0m'
+ exit 1
+ fi
+
+ - name: Remove .next directory
+ run: rm -rf .next
+
+ - name: Move temp to .next directory
+ run: mv temp .next
+
+ - name: Set PORT
+ run: echo "PORT=1000" >> $GITHUB_ENV
+
+ - name: Set App as Serverless
+ run: echo "SERVERLESS=true" >> $GITHUB_ENV
+
+ - name: Reload PM2
+ run: pm2 reload moopa --update-env
+
+