mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 04:22:06 +08:00
ci: add automatic version tagging workflow
This commit is contained in:
parent
992941fc68
commit
23295a049d
42
.github/workflows/auto-tag.yml
vendored
Normal file
42
.github/workflows/auto-tag.yml
vendored
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
name: Auto Tag
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- '.gitignore'
|
||||||
|
- '.github/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
auto-tag:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Get latest tag
|
||||||
|
id: get_latest_tag
|
||||||
|
run: |
|
||||||
|
git fetch --tags
|
||||||
|
latest_tag=$(git tag -l 'v*' --sort=-v:refname | head -n 1)
|
||||||
|
if [ -z "$latest_tag" ]; then
|
||||||
|
echo "version=v0.1.0" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
major=$(echo $latest_tag | cut -d. -f1)
|
||||||
|
minor=$(echo $latest_tag | cut -d. -f2)
|
||||||
|
patch=$(echo $latest_tag | cut -d. -f3)
|
||||||
|
new_patch=$((patch + 1))
|
||||||
|
echo "version=$major.$minor.$new_patch" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Create new tag
|
||||||
|
run: |
|
||||||
|
new_tag=${{ steps.get_latest_tag.outputs.version }}
|
||||||
|
git tag $new_tag
|
||||||
|
git push origin $new_tag
|
Loading…
x
Reference in New Issue
Block a user