Files
Frontend/.gitea/workflows/frontend.yml
T
2026-03-21 18:18:16 +03:30

98 lines
3.5 KiB
YAML

name: Frontend CI/CD
on:
push:
branches: [production]
paths:
- '**'
- '.gitea/workflows/frontend.yml'
pull_request:
branches: [production]
paths:
- '**'
- '.gitea/workflows/frontend.yml'
jobs:
build-and-test:
name: Build, Lint & Test
runs-on: self-hosted
container:
image: mirror2.chabokan.net/ubuntu:24.04
options: --add-host gitea:172.17.0.1
steps:
- name: Setup Ubuntu apt mirrors
run: |
tee /etc/apt/sources.list > /dev/null <<'EOF'
deb https://mirror-linux.runflare.com/ubuntu/ noble main restricted universe multiverse
deb https://mirror-linux.runflare.com/ubuntu/ noble-updates main restricted universe multiverse
deb https://mirror-linux.runflare.com/ubuntu/ noble-backports main restricted universe multiverse
deb https://mirror-linux.runflare.com/ubuntu/ noble-security main restricted universe multiverse
deb [trusted=yes] https://mirror2.chabokan.net/ubuntu noble main universe
deb [trusted=yes] https://mirror2.chabokan.net/ubuntu noble-updates main universe
deb [trusted=yes] https://mirror2.chabokan.net/ubuntu noble-security main universe
deb http://mirror.iranserver.com/ubuntu/ noble main restricted
deb-src http://mirror.iranserver.com/ubuntu/ noble main restricted
deb http://mirror.iranserver.com/ubuntu/ noble-updates main restricted
deb-src http://mirror.iranserver.com/ubuntu/ noble-updates main restricted
deb http://mirror.iranserver.com/ubuntu/ noble universe
deb-src http://mirror.iranserver.com/ubuntu/ noble universe
deb http://mirror.iranserver.com/ubuntu/ noble-updates universe
deb http://mirror.iranserver.com/ubuntu/ noble multiverse
deb-src http://mirror.iranserver.com/ubuntu/ noble multiverse
deb http://mirror.iranserver.com/ubuntu/ noble-updates multiverse
deb-src http://mirror.iranserver.com/ubuntu/ noble-updates multiverse
deb http://mirror.iranserver.com/ubuntu/ noble-backports main restricted universe multiverse
deb-src http://mirror.iranserver.com/ubuntu/ noble-backports main restricted universe multiverse
EOF
apt-get update
- name: Install system dependencies
run: |
apt-get install -y git
- name: Checkout repository
run: |
git clone http://gitea:3000/sajad-dev/Frontend.git .
- name: Configure NPM Mirrors
run: |
npm config set registry https://package-mirror.liara.ir/repository/npm/
npm config set @runflare:registry https://mirror-npm.runflare.com/
npm config set @chabokan:registry https://mirror2.chabokan.net/npm/
npm config set strict-ssl false
npm config set fetch-retries 5
npm config set fetch-retry-mintimeout 20000
- name: Setup SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p ${{ secrets.SERVER_SSH_PORT }} -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
- name: Deploy
run: |
ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} -p ${{ secrets.SERVER_SSH_PORT }} << 'EOF'
cd application/Frontend
git pull origin production
docker compose -f docker-compose-prod.yml down
docker compose -f docker-compose-prod.yml up -d --build
EOF