Улучшенный CI/CD

This commit is contained in:
RoyceDa
2026-03-22 19:38:24 +02:00
parent be16080bda
commit 37f6b0bd1d

View File

@@ -1,5 +1,6 @@
name: Build rosetta-wss
run-name: Build and Deploy WSS
on:
push:
branches:
@@ -9,42 +10,23 @@ on:
jobs:
build:
runs-on: java-builders
steps:
- name: Install Node.js
run: |
if command -v apt-get &> /dev/null; then
sudo apt-get update && sudo apt-get install -y nodejs npm
elif command -v brew &> /dev/null; then
brew install node
fi
container:
image: maven:3.9.9-eclipse-temurin-21
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Install maven IF not Exists
run: |
if ! command -v mvn &> /dev/null; then
echo "Maven not found, installing..."
if command -v apt-get &> /dev/null; then
sudo apt-get update && sudo apt-get install -y maven
elif command -v brew &> /dev/null; then
brew install maven
fi
else
echo "Maven is already installed."
fi
uses: actions/checkout@v6
- name: Build with Maven
run: mvn clean package
- name: List build directory
run: ls -la build/
run: mvn -B clean package
- name: List build artifacts
run: |
ls -la
ls -la target || true
ls -la build || true
- name: Deploy to server via SSH
uses: appleboy/scp-action@v1
with:
@@ -58,7 +40,7 @@ jobs:
rm: false
debug: true
flatten: true
- name: Restart Docker containers
uses: appleboy/ssh-action@v1.2.5
with:
@@ -68,6 +50,5 @@ jobs:
port: ${{ secrets.WSS_SSH_PORT }}
script: |
cd ${{ secrets.WSS_DEPLOY_PATH }}
docker-compose down
docker compose up -d --build
docker compose down
docker compose up -d --build