mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 04:22:06 +08:00
chore: refine auto-tag workflow with version output and enhanced debugging
- Changed output variable from 'new_tag' to 'version' for clarity in the auto-tag job. - Introduced a new version variable to store the generated version, improving readability. - Added debug steps to output version information and job outputs, aiding in troubleshooting. - Updated validation step to provide clearer error messages and confirmation of version validation success.
This commit is contained in:
parent
6fb415bfcb
commit
c4ecb7cede
26
.github/workflows/auto-tag.yml
vendored
26
.github/workflows/auto-tag.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
auto-tag:
|
auto-tag:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
outputs:
|
outputs:
|
||||||
new_tag: ${{ steps.get_latest_tag.outputs.version }}
|
version: ${{ steps.get_latest_tag.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
@ -29,22 +29,26 @@ jobs:
|
|||||||
git fetch --tags || exit 1
|
git fetch --tags || exit 1
|
||||||
latest_tag=$(git tag -l 'v*' --sort=-v:refname | head -n 1)
|
latest_tag=$(git tag -l 'v*' --sort=-v:refname | head -n 1)
|
||||||
if [ -z "$latest_tag" ]; then
|
if [ -z "$latest_tag" ]; then
|
||||||
echo "version=v0.1.0" >> $GITHUB_OUTPUT
|
new_version="v0.1.0"
|
||||||
else
|
else
|
||||||
major=$(echo $latest_tag | cut -d. -f1)
|
major=$(echo $latest_tag | cut -d. -f1)
|
||||||
minor=$(echo $latest_tag | cut -d. -f2)
|
minor=$(echo $latest_tag | cut -d. -f2)
|
||||||
patch=$(echo $latest_tag | cut -d. -f3)
|
patch=$(echo $latest_tag | cut -d. -f3)
|
||||||
new_patch=$((patch + 1))
|
new_patch=$((patch + 1))
|
||||||
echo "version=$major.$minor.$new_patch" >> $GITHUB_OUTPUT
|
new_version="$major.$minor.$new_patch"
|
||||||
fi
|
fi
|
||||||
|
echo "version=$new_version" >> $GITHUB_OUTPUT
|
||||||
|
echo "Generated version: $new_version"
|
||||||
|
|
||||||
- name: Validate version
|
- name: Validate version
|
||||||
run: |
|
run: |
|
||||||
new_tag=${{ steps.get_latest_tag.outputs.version }}
|
new_tag="${{ steps.get_latest_tag.outputs.version }}"
|
||||||
|
echo "Validating version: $new_tag"
|
||||||
if [[ ! $new_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
if [[ ! $new_tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||||
echo "Invalid version format: $new_tag"
|
echo "::error::Invalid version format: $new_tag"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "Version validation passed"
|
||||||
|
|
||||||
- name: Create new tag
|
- name: Create new tag
|
||||||
env:
|
env:
|
||||||
@ -56,12 +60,16 @@ jobs:
|
|||||||
git tag -a $new_tag -m "Release $new_tag"
|
git tag -a $new_tag -m "Release $new_tag"
|
||||||
git push origin $new_tag
|
git push origin $new_tag
|
||||||
|
|
||||||
|
- name: Debug output
|
||||||
|
run: |
|
||||||
|
echo "Version output: ${{ steps.get_latest_tag.outputs.version }}"
|
||||||
|
echo "Job outputs: ${{ toJSON(needs.auto-tag.outputs) }}"
|
||||||
|
echo "::debug::Version value: ${{ steps.get_latest_tag.outputs.version }}"
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: auto-tag
|
needs: auto-tag
|
||||||
if: |
|
if: success() && needs.auto-tag.outputs.version != ''
|
||||||
success() &&
|
|
||||||
needs.auto-tag.outputs.new_tag != ''
|
|
||||||
uses: ./.github/workflows/release.yml
|
uses: ./.github/workflows/release.yml
|
||||||
with:
|
with:
|
||||||
version: ${{ needs.auto-tag.outputs.new_tag }}
|
version: ${{ needs.auto-tag.outputs.version }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user