Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27841c72fe | ||
|
|
0fabd2aea3 | ||
|
|
e777399e72 | ||
|
|
66101c80c9 | ||
|
|
43bc32c77b | ||
|
|
d3cfa1cbcf | ||
|
|
dc5a26c146 | ||
|
|
0acef09910 |
@@ -5,14 +5,10 @@ on:
|
||||
branches:
|
||||
- master
|
||||
- release
|
||||
tags:
|
||||
- '*'
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
@@ -143,6 +139,9 @@ jobs:
|
||||
tag:
|
||||
name: Tag Commit
|
||||
runs-on: ubuntu-22.04
|
||||
rules:
|
||||
- if: github.event_name == 'push' && github.ref_type == 'tag'
|
||||
when: never
|
||||
# needs: lint
|
||||
|
||||
steps:
|
||||
@@ -154,7 +153,8 @@ jobs:
|
||||
- name: Get latest tag
|
||||
id: get-latest-tag
|
||||
run: |
|
||||
git fetch --tags
|
||||
git fetch --tags --force
|
||||
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo 'v0.0.0')
|
||||
echo $LATEST_TAG
|
||||
|
||||
@@ -173,9 +173,23 @@ jobs:
|
||||
NEW_PATCH=$((PATCH + 1))
|
||||
NEW_TAG="v${MAJOR}.${MINOR}.${NEW_PATCH}"
|
||||
|
||||
echo "NEW_TAG=${NEW_TAG}" >> $GITHUB_OUTPUT
|
||||
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Push tag
|
||||
if git ls-remote --tags origin "refs/tags/$NEW_TAG" | grep -q "$NEW_TAG"; then
|
||||
echo "Tag $NEW_TAG already exists remotely, skipping tag creation"
|
||||
echo "TAG_EXISTS=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "TAG_EXISTS=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Push tag (if it doesn't exist)
|
||||
if: steps.get-latest-tag.outputs.TAG_EXISTS == 'false'
|
||||
run: |
|
||||
git tag ${{ steps.get-latest-tag.outputs.NEW_TAG }}
|
||||
git push origin ${{ steps.get-latest-tag.outputs.NEW_TAG }}
|
||||
echo "Successfully pushed tag: ${{ steps.get-latest-tag.outputs.NEW_TAG }}"
|
||||
|
||||
- name: Skip tag push (tag already exists)
|
||||
if: steps.get-latest-tag.outputs.TAG_EXISTS == 'true'
|
||||
run: |
|
||||
echo "Skipping tag push - tag ${{ steps.get-latest-tag.outputs.NEW_TAG }} already exists remotely"
|
||||
|
||||
Reference in New Issue
Block a user