fix(ci): contourner upload-artifact Gitea — build sur docker-host
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 <cursoragent@cursor.com>
This commit is contained in:
49
.github/workflows/ci.yaml
vendored
49
.github/workflows/ci.yaml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user