Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 03edc314f8 | |||
| d27bc1f298 | |||
| 7f9806af8c | |||
| 5b33c1a3e9 | |||
| b44cc30ab5 | |||
| 07726c3d5a | |||
| c4ea928e14 |
82
.gitea/workflows/deploy.yml
Normal file
82
.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
name: Klc-admin-rewamp-Frontend
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- beta
|
||||||
|
- testing
|
||||||
|
- client
|
||||||
|
- staging
|
||||||
|
- production
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- beta
|
||||||
|
- testing
|
||||||
|
- client
|
||||||
|
- staging
|
||||||
|
- production
|
||||||
|
jobs:
|
||||||
|
Klc-admin-rewamp-Build-Test:
|
||||||
|
name: Build and Test PR
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
- name: Installing Dependecies
|
||||||
|
run: npm i
|
||||||
|
- name: Check Build
|
||||||
|
run: npm run build
|
||||||
|
- name: Auditing Node Dependecies
|
||||||
|
run: npm audit --audit-level=critical
|
||||||
|
|
||||||
|
Minglar-Deployment:
|
||||||
|
name: Deploying code in Server
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code in Runner
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Determining Project Folder
|
||||||
|
run: |
|
||||||
|
echo "Detected Branch Name : ${{ gitea.ref_name }}"
|
||||||
|
BRANCH_NAME=${{ gitea.ref_name }}
|
||||||
|
case "$BRANCH_NAME" in
|
||||||
|
beta)
|
||||||
|
echo "PROJECT_FOLDER=null" >> $GITHUB_ENV
|
||||||
|
;;
|
||||||
|
testing)
|
||||||
|
echo "PROJECT_FOLDER=/home/klc/klc-frontend/Test_Release/KLC-Website-Frontend" >> $GITHUB_ENV
|
||||||
|
;;
|
||||||
|
client)
|
||||||
|
echo "PROJECT_FOLDER=null" >> $GITHUB_ENV
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo " UNKNOWN BRANCH"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo "BRANCH_NAME=${{ gitea.ref_name }}" >> $GITHUB_ENV
|
||||||
|
- name: Deploy Using SSH
|
||||||
|
uses: appleboy/ssh-action@v1
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.BETA_SERVER_HOST }}
|
||||||
|
username: ${{ secrets.BETA_SERVER_USERNAME }}
|
||||||
|
password: ${{ secrets.BETA_SERVER_PASSWORD }}
|
||||||
|
port: ${{ secrets.BETA_SERVER_PORT }}
|
||||||
|
envs: BRANCH_NAME,PROJECT_FOLDER
|
||||||
|
script: |
|
||||||
|
set -e
|
||||||
|
cd $PROJECT_FOLDER
|
||||||
|
git fetch
|
||||||
|
git reset --hard origin/$BRANCH_NAME
|
||||||
|
git stash && git stash clear
|
||||||
|
git pull origin $BRANCH_NAME
|
||||||
|
echo "Node Module Installation "
|
||||||
|
npm i
|
||||||
|
echo "Building..."
|
||||||
|
npm run build
|
||||||
Reference in New Issue
Block a user