diff --git a/.github/workflows/docker-ghcr.yml b/.github/workflows/docker-ghcr.yml index fc1808e..d711391 100644 --- a/.github/workflows/docker-ghcr.yml +++ b/.github/workflows/docker-ghcr.yml @@ -3,9 +3,9 @@ on: workflow_dispatch: inputs: version: - description: 'Version number' + description: '版本号 (例如: v1.0.0)' required: true - default: 'latest' + default: 'v1.0.0' jobs: build: @@ -36,7 +36,12 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - 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 run: | @@ -53,4 +58,4 @@ jobs: --build-arg VERSION=${{ env.VERSION }} \ -f Dockerfile . env: - GHCR_PUBLIC: true # 将镜像设置为公开 \ No newline at end of file + GHCR_PUBLIC: true \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73931ec..c4279e3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: 发布二进制文件 on: - workflow_dispatch: # 手动触发 + workflow_dispatch: inputs: version: description: '版本号 (例如: v1.0.0)' @@ -18,7 +18,7 @@ jobs: - name: 检出代码 uses: actions/checkout@v4 with: - fetch-depth: 0 # 获取完整历史,用于生成变更日志 + fetch-depth: 0 - name: 设置Go环境 uses: actions/setup-go@v5