Add .gitea/workflows/deploy.yml
Some checks failed
Klc-admin-rewamp-Frontend / Build and Test PR (push) Has been skipped
Klc-admin-rewamp-Frontend / Deploying code in Server (push) Failing after 16s

This commit is contained in:
2026-03-23 09:21:09 +00:00
parent 6f72f1c828
commit c4ea928e14

View 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