mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-09-14 14:06:44 +08:00
docs: 测试新的构建
This commit is contained in:
parent
3c8511e91f
commit
ad5798d02e
12
.github/conf/.goreleaser.yml
vendored
12
.github/conf/.goreleaser.yml
vendored
@ -1,5 +1,5 @@
|
|||||||
# 项目名称 - 使用默认值或环境变量
|
# 项目名称 - 直接使用环境变量
|
||||||
project_name: "{{ .Env.PROJECT_NAME | default .ProjectName }}"
|
project_name: "{{ .Env.PROJECT_NAME }}"
|
||||||
|
|
||||||
# 构建前钩子
|
# 构建前钩子
|
||||||
before:
|
before:
|
||||||
@ -97,8 +97,8 @@ changelog:
|
|||||||
# 发布配置
|
# 发布配置
|
||||||
release:
|
release:
|
||||||
github:
|
github:
|
||||||
owner: "{{ .Env.GITHUB_OWNER | default .GitHubOwner }}"
|
owner: "{{ .Env.GITHUB_OWNER }}"
|
||||||
name: "{{ .Env.GITHUB_REPO | default .ProjectName }}"
|
name: "{{ .Env.GITHUB_REPO }}"
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: auto
|
prerelease: auto
|
||||||
mode: replace
|
mode: replace
|
||||||
@ -111,11 +111,11 @@ release:
|
|||||||
|
|
||||||
下载对应平台的二进制文件即可使用。
|
下载对应平台的二进制文件即可使用。
|
||||||
|
|
||||||
**完整更新日志**: https://github.com/{{ .Env.GITHUB_OWNER | default .GitHubOwner }}/{{ .Env.GITHUB_REPO | default .ProjectName }}/compare/{{ .PreviousTag }}...{{ .Tag }}
|
**完整更新日志**: https://github.com/{{ .Env.GITHUB_OWNER }}/{{ .Env.GITHUB_REPO }}/compare/{{ .PreviousTag }}...{{ .Tag }}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
如有问题请提交 [Issue](https://github.com/{{ .Env.GITHUB_OWNER | default .GitHubOwner }}/{{ .Env.GITHUB_REPO | default .ProjectName }}/issues) 💬
|
如有问题请提交 [Issue](https://github.com/{{ .Env.GITHUB_OWNER }}/{{ .Env.GITHUB_REPO }}/issues) 💬
|
||||||
|
|
||||||
# 快照版本
|
# 快照版本
|
||||||
snapshot:
|
snapshot:
|
||||||
|
80
.github/workflows/release.yml
vendored
80
.github/workflows/release.yml
vendored
@ -3,8 +3,8 @@ name: 发布构建
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'v*' # 只响应以 v 开头的标签,如 v1.0.0
|
- 'v*'
|
||||||
workflow_dispatch: # 支持手动触发
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
tag:
|
||||||
description: '发布标签'
|
description: '发布标签'
|
||||||
@ -22,11 +22,17 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
|
|
||||||
|
# 设置作业级别的环境变量
|
||||||
|
env:
|
||||||
|
GITHUB_OWNER: ${{ github.repository_owner }}
|
||||||
|
GITHUB_REPO: ${{ github.event.repository.name }}
|
||||||
|
PROJECT_NAME: ${{ github.event.repository.name }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 检出代码
|
- name: 📥 检出代码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # 获取完整的 git 历史,用于生成变更日志
|
fetch-depth: 0
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: 🔍 获取项目信息
|
- name: 🔍 获取项目信息
|
||||||
@ -39,8 +45,8 @@ jobs:
|
|||||||
- name: 🐹 设置 Go 环境
|
- name: 🐹 设置 Go 环境
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.21' # 使用更新的 Go 版本
|
go-version: '1.21'
|
||||||
cache: true # 启用 Go 模块缓存
|
cache: true
|
||||||
|
|
||||||
- name: 📦 下载依赖
|
- name: 📦 下载依赖
|
||||||
run: |
|
run: |
|
||||||
@ -79,9 +85,6 @@ jobs:
|
|||||||
workdir: .
|
workdir: .
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GITHUB_OWNER: ${{ steps.project.outputs.owner }}
|
|
||||||
GITHUB_REPO: ${{ steps.project.outputs.repo }}
|
|
||||||
PROJECT_NAME: ${{ steps.project.outputs.repo }}
|
|
||||||
|
|
||||||
- name: 📋 上传构建产物
|
- name: 📋 上传构建产物
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@ -109,63 +112,4 @@ jobs:
|
|||||||
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||||
ls -la dist/ >> $GITHUB_STEP_SUMMARY
|
ls -la dist/ >> $GITHUB_STEP_SUMMARY
|
||||||
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 可选:发布到 Docker Hub
|
|
||||||
docker:
|
|
||||||
name: 构建 Docker 镜像
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: goreleaser
|
|
||||||
if: success()
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 📥 检出代码
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: 🔍 获取元数据
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
${{ github.repository }}
|
|
||||||
tags: |
|
|
||||||
type=ref,event=tag
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
|
|
||||||
- name: 🐳 设置 Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: 🔐 登录 Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: 🚀 构建并推送 Docker 镜像
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
||||||
# 可选:通知步骤
|
|
||||||
notify:
|
|
||||||
name: 发送通知
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [goreleaser]
|
|
||||||
if: always()
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 📧 发送成功通知
|
|
||||||
if: needs.goreleaser.result == 'success'
|
|
||||||
run: |
|
|
||||||
echo "✅ 发布成功完成!"
|
|
||||||
echo "版本: ${GITHUB_REF#refs/tags/}"
|
|
||||||
echo "查看发布: https://github.com/${{ github.repository }}/releases"
|
|
||||||
|
|
||||||
- name: ⚠️ 发送失败通知
|
|
||||||
if: needs.goreleaser.result == 'failure'
|
|
||||||
run: |
|
|
||||||
echo "❌ 发布失败!"
|
|
||||||
echo "请检查构建日志: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
|
17
.github/workflows/test-build.yml
vendored
17
.github/workflows/test-build.yml
vendored
@ -31,6 +31,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
|
||||||
|
# 设置作业级别的环境变量
|
||||||
|
env:
|
||||||
|
GITHUB_OWNER: ${{ github.repository_owner }}
|
||||||
|
GITHUB_REPO: ${{ github.event.repository.name }}
|
||||||
|
PROJECT_NAME: ${{ github.event.repository.name }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 检出代码
|
- name: 📥 检出代码
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -69,6 +75,10 @@ jobs:
|
|||||||
echo "分支: ${{ steps.project.outputs.branch }}"
|
echo "分支: ${{ steps.project.outputs.branch }}"
|
||||||
echo "提交: ${{ steps.project.outputs.short_sha }}"
|
echo "提交: ${{ steps.project.outputs.short_sha }}"
|
||||||
echo "仓库: ${{ steps.project.outputs.owner }}/${{ steps.project.outputs.repo }}"
|
echo "仓库: ${{ steps.project.outputs.owner }}/${{ steps.project.outputs.repo }}"
|
||||||
|
echo "环境变量:"
|
||||||
|
echo "- GITHUB_OWNER: $GITHUB_OWNER"
|
||||||
|
echo "- GITHUB_REPO: $GITHUB_REPO"
|
||||||
|
echo "- PROJECT_NAME: $PROJECT_NAME"
|
||||||
|
|
||||||
- name: 🧪 运行测试
|
- name: 🧪 运行测试
|
||||||
if: ${{ !inputs.skip_tests }}
|
if: ${{ !inputs.skip_tests }}
|
||||||
@ -81,10 +91,6 @@ jobs:
|
|||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: latest
|
version: latest
|
||||||
args: check -f .github/conf/.goreleaser.yml
|
args: check -f .github/conf/.goreleaser.yml
|
||||||
env:
|
|
||||||
GITHUB_OWNER: ${{ steps.project.outputs.owner }}
|
|
||||||
GITHUB_REPO: ${{ steps.project.outputs.repo }}
|
|
||||||
PROJECT_NAME: ${{ steps.project.outputs.repo }}
|
|
||||||
|
|
||||||
- name: 🚀 测试构建 (Snapshot 模式)
|
- name: 🚀 测试构建 (Snapshot 模式)
|
||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
@ -95,9 +101,6 @@ jobs:
|
|||||||
workdir: .
|
workdir: .
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GITHUB_OWNER: ${{ steps.project.outputs.owner }}
|
|
||||||
GITHUB_REPO: ${{ steps.project.outputs.repo }}
|
|
||||||
PROJECT_NAME: ${{ steps.project.outputs.repo }}
|
|
||||||
|
|
||||||
- name: 📋 上传测试产物
|
- name: 📋 上传测试产物
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
Loading…
Reference in New Issue
Block a user