This commit is contained in:
user123
2026-01-10 21:23:38 +08:00
parent f8828ccb74
commit c6d95e683f
2 changed files with 11 additions and 6 deletions

View File

@@ -3,9 +3,9 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
version: version:
description: 'Version number' description: '版本号 (例如: v1.0.0)'
required: true required: true
default: 'latest' default: 'v1.0.0'
jobs: jobs:
build: build:
@@ -36,7 +36,12 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Set version from input - name: Set version from input
run: echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV run: |
VERSION=${{ github.event.inputs.version }}
if [[ $VERSION == v* ]]; then
VERSION=${VERSION:1}
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Convert repository name to lowercase - name: Convert repository name to lowercase
run: | run: |
@@ -53,4 +58,4 @@ jobs:
--build-arg VERSION=${{ env.VERSION }} \ --build-arg VERSION=${{ env.VERSION }} \
-f Dockerfile . -f Dockerfile .
env: env:
GHCR_PUBLIC: true # 将镜像设置为公开 GHCR_PUBLIC: true

View File

@@ -1,7 +1,7 @@
name: 发布二进制文件 name: 发布二进制文件
on: on:
workflow_dispatch: # 手动触发 workflow_dispatch:
inputs: inputs:
version: version:
description: '版本号 (例如: v1.0.0)' description: '版本号 (例如: v1.0.0)'
@@ -18,7 +18,7 @@ jobs:
- name: 检出代码 - name: 检出代码
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 # 获取完整历史,用于生成变更日志 fetch-depth: 0
- name: 设置Go环境 - name: 设置Go环境
uses: actions/setup-go@v5 uses: actions/setup-go@v5