Files
ai-portal/.gitea/workflows/test.yml
T
Workflow config file is invalid. Please check your config file: model.ReadWorkflow: yaml: line 10: did not find expected key
2026-06-15 11:02:34 +08:00

34 lines
1.3 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: Build and Push Next.js to Private Registry
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# 替换 actions/checkout@v4:直接利用 Runner 容器自带的 git 命令克隆
# Gitea 会自动注入环境变量 $GITEA_SERVER_URL, $GITEA_REPOSITORY, $GITEA_SHA
- name: 检查代码 (本地原生 Git)
run: |
git clone ${{ github.server_url }}/${{ github.repository }}.git .
git checkout ${{ github.sha }}
- name: 生成短哈希版本号
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
# 替换 docker/setup-buildx-action:在纯内网,如果 Runner 宿主机已经有常规 Docker
# 可以直接使用本机的 docker build 命令,不再需要下载外网的 buildx action。
- name: 构建并推送镜像 (本地 Docker)
run: |
# 💡 请把下面的 nextjs-app 替换成你实际的英文应用名称(不要用中文)
IMAGE_NAME="192.168.10.236:31051/nextjs-app"
SHA_TAG="${{ steps.vars.outputs.sha_short }}"
docker build -t ${IMAGE_NAME}:latest -t ${IMAGE_NAME}:${SHA_TAG} -f ./Dockerfile .
docker push ${IMAGE_NAME}:latest
docker push ${IMAGE_NAME}:${SHA_TAG}