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:
@@ -91,24 +91,6 @@ jobs:
|
|||||||
-d "parse_mode=Markdown" || true
|
-d "parse_mode=Markdown" || true
|
||||||
fi
|
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:
|
deploy:
|
||||||
name: Deploy production (on server)
|
name: Deploy production (on server)
|
||||||
needs: ci
|
needs: ci
|
||||||
@@ -123,10 +105,32 @@ jobs:
|
|||||||
git fetch origin main
|
git fetch origin main
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
- name: Download web artifact
|
# Build sur docker-host : évite upload-artifact Gitea (souvent cassé en prod).
|
||||||
uses: actions/download-artifact@v3
|
- name: Setup Node 22
|
||||||
|
uses: actions/setup-node@v4
|
||||||
with:
|
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
|
- name: Update .env.docker
|
||||||
env:
|
env:
|
||||||
@@ -238,6 +242,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Deploy on 192.168.1.190
|
- name: Deploy on 192.168.1.190
|
||||||
env:
|
env:
|
||||||
ARTIFACT_TGZ: ${{ github.workspace }}/web-artifact.tgz
|
ARTIFACT_TGZ: /tmp/web-artifact.tgz
|
||||||
EXPECTED_COMMIT: ${{ github.sha }}
|
EXPECTED_COMMIT: ${{ github.sha }}
|
||||||
run: bash /opt/memento/scripts/deploy-prod.sh
|
run: bash /opt/memento/scripts/deploy-prod.sh
|
||||||
|
|||||||
49
.github/workflows/ci.yaml
vendored
49
.github/workflows/ci.yaml
vendored
@@ -91,25 +91,6 @@ jobs:
|
|||||||
-d "parse_mode=Markdown" || true
|
-d "parse_mode=Markdown" || true
|
||||||
fi
|
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:
|
deploy:
|
||||||
name: Deploy production (on server)
|
name: Deploy production (on server)
|
||||||
needs: ci
|
needs: ci
|
||||||
@@ -124,11 +105,31 @@ jobs:
|
|||||||
git fetch origin main
|
git fetch origin main
|
||||||
git reset --hard origin/main
|
git reset --hard origin/main
|
||||||
|
|
||||||
- name: Download web artifact
|
- name: Setup Node 22
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/setup-node@v4
|
||||||
continue-on-error: true
|
|
||||||
with:
|
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
|
- name: Update .env.docker
|
||||||
env:
|
env:
|
||||||
@@ -229,6 +230,6 @@ jobs:
|
|||||||
|
|
||||||
- name: Deploy on 192.168.1.190
|
- name: Deploy on 192.168.1.190
|
||||||
env:
|
env:
|
||||||
ARTIFACT_TGZ: ${{ github.workspace }}/web-artifact.tgz
|
ARTIFACT_TGZ: /tmp/web-artifact.tgz
|
||||||
EXPECTED_COMMIT: ${{ github.sha }}
|
EXPECTED_COMMIT: ${{ github.sha }}
|
||||||
run: bash /opt/memento/scripts/deploy-prod.sh
|
run: bash /opt/memento/scripts/deploy-prod.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user