test
Pure Run Build / build (push) Successful in 31s
Pure Run Build / build (push) Successful in 19s

This commit is contained in:
2026-07-23 17:43:39 +08:00
parent 6f7e16345d
commit 52ba70b79d
+40
View File
@@ -0,0 +1,40 @@
name: Pure Run Build
on:
push:
workflow_dispatch:
inputs:
build_image:
description: "是否编译并推送 Docker 镜像"
required: false
default: "false"
image_tag:
description: "自定义镜像 tag"
required: false
default: "manual"
jobs:
build:
runs-on: ubuntu-latest
container:
image: git.vipjhzf.cn/github/ci-base:latest
steps:
- name: 克隆
run: |
git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
git checkout ${{ gitea.sha }}
- name: 编译
run: |
go mod tidy
CGO_ENABLED=0 go build -o myapp .
- name: 打镜像(仅手动触发时)
if: ${{ inputs.build_image == 'true' }}
run: |
cat > Dockerfile <<EOF
FROM git.vipjhzf.cn/github/alpine:3.16.2
WORKDIR /app
COPY ./myapp /app/server
CMD ["/app/server"]
EOF
docker build -t myapp:${{ inputs.image_tag }} .