Version 1.0.0 - Frontend Pipeline
Some checks failed
Frontend Deployment / deploy-frontend (push) Failing after 11s
Some checks failed
Frontend Deployment / deploy-frontend (push) Failing after 11s
This commit is contained in:
@@ -10,23 +10,24 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
# 1️⃣ Checkout du code
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# 2️⃣ Setup Node.js (ici Node 22)
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: '22'
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
# 3️⃣ Installer les dépendances et builder le frontend
|
||||||
run: |
|
- name: Build frontend
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: Build Vite frontend
|
|
||||||
run: |
|
run: |
|
||||||
|
cd chopin-frontend
|
||||||
|
npm install --omit=dev
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
|
# 4️⃣ Setup SSH pour la connexion vers alpha
|
||||||
- name: Setup SSH
|
- name: Setup SSH
|
||||||
env:
|
env:
|
||||||
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
@@ -34,28 +35,14 @@ jobs:
|
|||||||
mkdir -p ~/.ssh
|
mkdir -p ~/.ssh
|
||||||
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||||
chmod 600 ~/.ssh/id_rsa
|
chmod 600 ~/.ssh/id_rsa
|
||||||
ssh-keyscan -H alpha.raphix.fr >> ~/.ssh/known_hosts
|
ssh-keyscan alpha.raphix.fr >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
- name: Deploy frontend to alpha
|
# 5️⃣ Copier le build sur alpha
|
||||||
|
- name: Deploy frontend to Alpha
|
||||||
run: |
|
run: |
|
||||||
ssh -o StrictHostKeyChecking=no raphix@alpha.raphix.fr << 'EOF'
|
rsync -av --delete chopin-frontend/dist/ raphix@alpha.raphix.fr:/home/gitlab-ci/chopin-frontend/dist/
|
||||||
sudo su - gitlab-ci << 'INNER_EOF'
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "[Frontend-Deploy] - START"
|
# 6️⃣ Ajuster permissions sur alpha si nécessaire
|
||||||
|
- name: Set permissions on Alpha
|
||||||
# Nettoyage ancien build
|
run: |
|
||||||
rm -rf /home/gitlab-ci/chopin-frontend/dist
|
ssh raphix@alpha.raphix.fr "sudo chown -R gitlab-ci:gitlab-ci /home/gitlab-ci/chopin-frontend/dist"
|
||||||
rm -rf /home/gitlab-ci/chopin-frontend/node_modules
|
|
||||||
|
|
||||||
# Copier les fichiers build depuis le workspace CI
|
|
||||||
mkdir -p /home/gitlab-ci/chopin-frontend
|
|
||||||
rsync -av --delete /workspace/subsonics/chopin-frontend/dist/ /home/gitlab-ci/chopin-frontend/dist/
|
|
||||||
|
|
||||||
# Reinstaller les dépendances pour npm scripts côté serveur si nécessaire
|
|
||||||
cd /home/gitlab-ci/chopin-frontend
|
|
||||||
npm ci --omit=dev
|
|
||||||
|
|
||||||
echo "[Frontend-Deploy] - END"
|
|
||||||
INNER_EOF
|
|
||||||
EOF
|
|
||||||
|
Reference in New Issue
Block a user