Skip to content

Commit

Permalink
Merge pull request #49 from holadmex/dev
Browse files Browse the repository at this point in the history
 Added deployment workflow for production
  • Loading branch information
Idimmusix authored Jul 21, 2024
2 parents 43465de + 8fcbc3b commit 190b8a4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build, Test, and Deploy for Prod Branch

on:
push:
branch:
- main

jobs:
build:
runs-on: self-hosted
defaults:
run:
working-directory: /var/www/aihomework/prod

steps:
- name: Pull from github
id: pull
run: |
git pull origin prod
- name: install dependencies
run: yarn install

- name: buld the dist
run: yarn build

- name: setup service file
run: sudo cp server-script/aihomeworkprod.service /etc/systemd/system

- name: start the app
run: |
sudo systemctl daemon-reload
sudo systemctl restart aihomeworkprod
# test:
# -name: Run test
# run: yarn jest

13 changes: 13 additions & 0 deletions server-script/aihomeworkprod.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=AIHomework-Prod
After=network.target

[Service]
WorkingDirectory=/var/www/aihomework/prod
ExecStart=/bin/bash /var/www/aihomework/prod/server-script/startappprod.sh
#Restart=on-failure
#RestartSec=20s
StartLimitInterval=0

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions server-script/startappprod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

cd /var/www/aihomework/prod/
/usr/bin/yarn prod

0 comments on commit 190b8a4

Please sign in to comment.