test
This commit is contained in:
@@ -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 }} .
|
||||
Reference in New Issue
Block a user