ci: optimize deploy pipeline with mirror, cache, corepack, and nginx reuse
Deploy Slides / build-and-deploy (push) Failing after 1s

This commit is contained in:
2026-07-17 23:51:34 +08:00
parent f3b9027220
commit 56d59030f7
+23 -11
View File
@@ -20,23 +20,35 @@ jobs:
with: with:
github-server-url: http://47.121.181.112:3000 github-server-url: http://47.121.181.112:3000
- name: Install pnpm - name: Enable pnpm via corepack
run: npm install -g pnpm run: corepack enable
- name: Cache pnpm store
uses: http://47.121.181.112:3000/actions/cache@v4
with:
path: /root/.local/share/pnpm/store
key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: pnpm-store-
- name: Install dependencies - name: Install dependencies
run: pnpm install --frozen-lockfile run: pnpm install --frozen-lockfile
env:
npm_config_registry: https://registry.npmmirror.com
- name: Build all decks - name: Build all decks
run: pnpm run build run: pnpm run build
- name: Deploy to nginx - name: Deploy to nginx
run: | run: |
docker rm -f slides-nginx 2>/dev/null || true if docker inspect slides-nginx >/dev/null 2>&1; then
docker run -d \ docker cp dist/. slides-nginx:/usr/share/nginx/html/
--name slides-nginx \ docker exec slides-nginx nginx -s reload
--restart unless-stopped \ else
-p 8080:80 \ docker run -d \
nginx:alpine --name slides-nginx \
docker cp nginx.conf slides-nginx:/etc/nginx/conf.d/default.conf --restart unless-stopped \
docker cp dist/. slides-nginx:/usr/share/nginx/html/ -p 8080:80 \
docker exec slides-nginx nginx -s reload nginx:alpine
docker cp nginx.conf slides-nginx:/etc/nginx/conf.d/default.conf
docker cp dist/. slides-nginx:/usr/share/nginx/html/
fi