Files
jinshen-website/.gitea/workflows/deploy.yml
R2m1liA 06c79dc520
All checks were successful
deploy to server / build-and-deploy (push) Successful in 7m38s
ci: 调整workflow
- 添加为构建工作流添加检测代理是否启用的job
2025-09-27 10:30:27 +08:00

59 lines
2.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: deploy to server
on: push
jobs:
build-and-deploy:
runs-on: node22-build
steps:
- name: Check Proxy
run: |
echo "HTTP_PROXY = $HTTP_PROXY"
echo "HTTPS_PROXY = $HTTPS_PROXY"
# 测试网络是否能透过代理访问一个外部 URL比如 google.com
# 也可以换成你常用的 npm registry / GitHub
curl -I https://www.google.com --max-time 10 || echo "curl to google failed"
# 测试拉取 npm 包或 ping github.com
curl -I https://registry.npmjs.org --max-time 10 || echo "curl to registry.npmjs.org failed"
ping -c 3 github.com || echo "ping github.com failed"
- name: Checkout
uses: actions/checkout@v5
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup node 22
uses: actions/setup-node@v5
with:
node-version: '22'
cache: 'pnpm'
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install
- name: Cache Nuxt build
uses: actions/cache@v4
with:
path: .nuxt
key: ${{ runner.os }}-nuxt-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-nuxt-
- name: Build project
run: pnpm run build
- name: Deploy to server
if: github.ref == 'refs/heads/master'
uses: easingthemes/ssh-deploy@main
with:
ARGS: "-rlgoDzvc -i --delete"
REMOTE_HOST: ${{ secrets.rsync_host }}
REMOTE_USER: ${{ secrets.rsync_username }}
SOURCE: ${{ secrets.rsync_source }}
TARGET: ${{ secrets.rsync_destination }}
SSH_PRIVATE_KEY: ${{ secrets.rsync_key }}
SCRIPT_AFTER: ${{ secrets.script_after_rsync }}