ci: add deploy-front workflow (static) + example docker-push workflow
deploy-userbase-front / build-and-deploy (push) Failing after 11m5s

This commit is contained in:
ab
2026-08-04 21:31:34 +08:00
parent e02dcc23da
commit e8eaee0e77
2 changed files with 73 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
name: deploy-userbase-front
on:
push:
branches: [main]
paths:
- 'front/**'
- '.gitea/workflows/deploy-front.yml'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
# node:20 自带 npm;通过已配置的 registry-mirrors 拉取
container:
image: node:20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use npm mirror (npmmirror)
working-directory: front
run: npm config set registry https://registry.npmmirror.com
- name: Install dependencies
working-directory: front
run: npm ci
- name: Build (prod -> dist/prod)
working-directory: front
run: npm run build:prod
- name: Deploy to static dir (/data/www/userbase/front)
# /data/www/userbase 由 act_runner 全局挂载进每个 job 容器
run: |
rm -rf /data/www/userbase/front
mkdir -p /data/www/userbase/front
cp -r front/dist/prod/. /data/www/userbase/front/
echo "deployed front -> /data/www/userbase/front"
- name: Done
run: ls -la /data/www/userbase/front | head
+32
View File
@@ -0,0 +1,32 @@
name: example-docker-push
# 示例:演示 act_runner 的 docker.sock 能力(构建并推送镜像到 Nexus docker-hosted)
# 需要仓库 Settings -> Actions Secrets 配置:
# NEXUS_USER = admin
# NEXUS_PASSWORD = <nexus admin password>
# 手动触发(Actions 页面 -> Run workflow),不会自动跑。
on:
workflow_dispatch:
inputs:
tag:
description: 'image tag to push'
required: false
default: 'demo'
jobs:
docker-build-push:
runs-on: ubuntu-latest
# docker:24 自带 docker CLI,复用宿主 docker daemon(act_runner 已挂载 docker.sock)
container:
image: docker:24
steps:
- uses: actions/checkout@v4
- name: Login to Nexus docker registry
run: echo "${{ secrets.NEXUS_PASSWORD }}" | docker login nexus:8083 -u ${{ secrets.NEXUS_USER }}
- name: Build image (front nginx)
run: docker build -t nexus:8083/docker-hosted/userbase-front:${{ inputs.tag }} -f front/docker/Dockerfile front
- name: Push image
run: docker push nexus:8083/docker-hosted/userbase-front:${{ inputs.tag }}