chore: update auto-tag workflow and GitHub Actions versions

- Simplified the workflow_call input in auto-tag-release.yml by removing unnecessary inputs.
- Updated actions/checkout and actions/setup-go to version 3 for improved performance and compatibility.
- Refined conditional checks for version tagging to use the new syntax for better clarity.
- Adjusted GoReleaser action to version 3, ensuring alignment with the latest features and fixes.
This commit is contained in:
煎饼果子卷鲨鱼辣椒 2024-12-30 19:21:30 +08:00
parent 2d008db25e
commit c41ade9b88

View File

@ -13,8 +13,7 @@ on:
- "**.md"
- "LICENSE"
- ".gitignore"
workflow_call:
inputs:
workflow_call: {}
permissions:
contents: write
@ -28,7 +27,7 @@ jobs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5.3.1
uses: fkirc/skip-duplicate-actions@v5.3.0
with:
cancel_others: "true"
concurrent_skipping: "same_content"
@ -48,14 +47,14 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
submodules: recursive
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v3
with:
go-version: "1.21"
check-latest: true
@ -75,7 +74,7 @@ jobs:
# 只在非tag推送时执行自动打tag
- name: Get latest tag
if: "!startsWith(github.ref, 'refs/tags/v')"
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
id: get_latest_tag
run: |
set -euo pipefail
@ -97,7 +96,7 @@ jobs:
echo "Generated version: $new_version"
- name: Validate version
if: "!startsWith(github.ref, 'refs/tags/v')"
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |
set -euo pipefail
new_tag="${{ steps.get_latest_tag.outputs.version }}"
@ -116,7 +115,7 @@ jobs:
echo "Version validation passed"
- name: Create new tag
if: "!startsWith(github.ref, 'refs/tags/v')"
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
@ -152,8 +151,8 @@ jobs:
# 修改 GoReleaser 步骤
- name: Run GoReleaser
if: startsWith(github.ref, 'refs/tags/v') || (success() && steps.get_latest_tag.outputs.version != '')
uses: goreleaser/goreleaser-action@v4
if: ${{ startsWith(github.ref, 'refs/tags/v') || (success() && steps.get_latest_tag.outputs.version != '') }}
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
@ -192,9 +191,7 @@ jobs:
# 改进验证步骤
- name: Verify Release
if: |
startsWith(github.ref, 'refs/tags/v') ||
(success() && steps.get_latest_tag.outputs.version != '')
if: ${{ startsWith(github.ref, 'refs/tags/v') || (success() && steps.get_latest_tag.outputs.version != '') }}
run: |
echo "Verifying release artifacts..."
if [ ! -d "dist" ]; then