From a99d1dafb268e84be331aa7d68c4db4da55980db Mon Sep 17 00:00:00 2001 From: Antigravity Date: Sun, 5 Jul 2026 20:10:15 +0000 Subject: [PATCH] =?UTF-8?q?fix(ci):=20contourner=20upload-artifact=20Gitea?= =?UTF-8?q?=20=E2=80=94=20build=20sur=20docker-host?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L'étape Upload web artifact échouait systématiquement (stockage artefacts Gitea instable). Le déploiement ne passera plus par upload/download-artifact entre runners. - CI ubuntu : lint + tests + build (validation uniquement) - Deploy docker-host : npm ci + build + tar local /tmp/web-artifact.tgz - deploy-prod.sh consomme l'artefact local, sans download-artifact Co-authored-by: Cursor --- .gitea/workflows/ci.yaml | 48 ++++++++++++++++++++------------------ .github/workflows/ci.yaml | 49 ++++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 46 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 2388b1e..d6fb9c9 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -91,24 +91,6 @@ jobs: -d "parse_mode=Markdown" || true fi - - name: Pack web artifact for deploy - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - working-directory: memento-note - run: | - tar czf ../web-artifact.tgz \ - .next/standalone .next/static public prisma \ - node_modules/.prisma node_modules/@prisma node_modules/prisma \ - docker-entrypoint.sh socket-server.ts tsconfig.json - ls -lh ../web-artifact.tgz - - - name: Upload web artifact - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - uses: actions/upload-artifact@v3 - with: - name: web-artifact - path: web-artifact.tgz - retention-days: 2 - deploy: name: Deploy production (on server) needs: ci @@ -123,10 +105,32 @@ jobs: git fetch origin main git reset --hard origin/main - - name: Download web artifact - uses: actions/download-artifact@v3 + # Build sur docker-host : évite upload-artifact Gitea (souvent cassé en prod). + - name: Setup Node 22 + uses: actions/setup-node@v4 with: - name: web-artifact + node-version: "22" + + - name: Build web artifact on server + working-directory: /opt/memento/memento-note + run: | + set -euo pipefail + npm ci --legacy-peer-deps + npx prisma generate + npm run build + for p in .next/standalone .next/static public prisma; do + [ -e "$p" ] || { echo "Missing build output: $p"; exit 1; } + done + tar czf /tmp/web-artifact.tgz \ + .next/standalone .next/static public prisma \ + node_modules/.prisma node_modules/@prisma node_modules/prisma \ + docker-entrypoint.sh socket-server.ts tsconfig.json + SIZE=$(stat -c%s /tmp/web-artifact.tgz) + if [ "$SIZE" -lt 1048576 ]; then + echo "ERROR: artifact too small ($SIZE bytes)" + exit 1 + fi + ls -lh /tmp/web-artifact.tgz - name: Update .env.docker env: @@ -238,6 +242,6 @@ jobs: - name: Deploy on 192.168.1.190 env: - ARTIFACT_TGZ: ${{ github.workspace }}/web-artifact.tgz + ARTIFACT_TGZ: /tmp/web-artifact.tgz EXPECTED_COMMIT: ${{ github.sha }} run: bash /opt/memento/scripts/deploy-prod.sh diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c9bce17..0cc816c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -91,25 +91,6 @@ jobs: -d "parse_mode=Markdown" || true fi - - name: Pack web artifact for deploy - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - working-directory: memento-note - run: | - tar czf ../web-artifact.tgz \ - .next/standalone .next/static public prisma \ - node_modules/.prisma node_modules/@prisma node_modules/prisma \ - docker-entrypoint.sh socket-server.ts tsconfig.json - ls -lh ../web-artifact.tgz - - - name: Upload web artifact - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - uses: actions/upload-artifact@v3 - continue-on-error: true - with: - name: web-artifact - path: web-artifact.tgz - retention-days: 2 - deploy: name: Deploy production (on server) needs: ci @@ -124,11 +105,31 @@ jobs: git fetch origin main git reset --hard origin/main - - name: Download web artifact - uses: actions/download-artifact@v3 - continue-on-error: true + - name: Setup Node 22 + uses: actions/setup-node@v4 with: - name: web-artifact + node-version: "22" + + - name: Build web artifact on server + working-directory: /opt/memento/memento-note + run: | + set -euo pipefail + npm ci --legacy-peer-deps + npx prisma generate + npm run build + for p in .next/standalone .next/static public prisma; do + [ -e "$p" ] || { echo "Missing build output: $p"; exit 1; } + done + tar czf /tmp/web-artifact.tgz \ + .next/standalone .next/static public prisma \ + node_modules/.prisma node_modules/@prisma node_modules/prisma \ + docker-entrypoint.sh socket-server.ts tsconfig.json + SIZE=$(stat -c%s /tmp/web-artifact.tgz) + if [ "$SIZE" -lt 1048576 ]; then + echo "ERROR: artifact too small ($SIZE bytes)" + exit 1 + fi + ls -lh /tmp/web-artifact.tgz - name: Update .env.docker env: @@ -229,6 +230,6 @@ jobs: - name: Deploy on 192.168.1.190 env: - ARTIFACT_TGZ: ${{ github.workspace }}/web-artifact.tgz + ARTIFACT_TGZ: /tmp/web-artifact.tgz EXPECTED_COMMIT: ${{ github.sha }} run: bash /opt/memento/scripts/deploy-prod.sh