Files
lzy dcebc1ec9c
build-and-deploy / build (push) Successful in 50s
ci: 构建后自动部署 dist 到 test.shoux.net
2026-07-24 01:43:57 +08:00

47 lines
1.4 KiB
YAML
Raw Permalink 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: build-and-deploy
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
# raw checkout:绕开 actions/checkout(服务器拉 github action 不通)
# 仓库 publicjob 容器经 official-site_default 网络访问 gitea:3000
- name: Checkout
run: |
git config --global --add safe.directory '*'
git clone "http://gitea:3000/${GITHUB_REPOSITORY}.git" .
git checkout "${GITHUB_SHA}"
- name: Install deps
run: npm ci --registry=https://registry.npmmirror.com
- name: Build
run: npm run build
- name: Verify dist
run: ls -la dist/
# 部署到 test.shoux.netjob 容器挂载宿主 /var/www/test-shoux-net → /deploy
- name: Deploy to test.shoux.net
run: |
rm -rf /deploy/*
cp -r dist/. /deploy/
echo "[deploy] dist -> /deploy (host /var/www/test-shoux-net)"
- name: Install ossutil
run: |
curl -fsSL -o /tmp/ossutilinstall.sh https://gosspublic.alicdn.com/ossutil/install.sh
bash /tmp/ossutilinstall.sh
- name: Sync to OSS
env:
OSS_ACCESS_KEY_ID: ${{ secrets.OSS_ACCESS_KEY_ID }}
OSS_ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
OSS_ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
OSS_BUCKET: ${{ secrets.OSS_BUCKET }}
run: bash scripts/deploy-oss.sh