Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5859bc4f4c | ||
|
|
9de6619407 | ||
|
|
27841c72fe | ||
|
|
0fabd2aea3 | ||
|
|
e777399e72 | ||
|
|
66101c80c9 | ||
|
|
43bc32c77b | ||
|
|
d3cfa1cbcf | ||
|
|
dc5a26c146 | ||
|
|
0acef09910 | ||
|
|
24fb916074 | ||
|
|
5aaadf4fe6 | ||
|
|
30a5e8340e | ||
|
|
42ea0f58fd |
@@ -5,17 +5,14 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- release
|
- release
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- release
|
- release
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
|
if: 0
|
||||||
name: Run golangci-lint
|
name: Run golangci-lint
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
@@ -43,6 +40,7 @@ jobs:
|
|||||||
golangci-lint run -c ./.golangci-lint.yaml --fix=false --color=always
|
golangci-lint run -c ./.golangci-lint.yaml --fix=false --color=always
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
if: 0
|
||||||
name: Build golang services
|
name: Build golang services
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: lint
|
needs: lint
|
||||||
@@ -67,10 +65,11 @@ jobs:
|
|||||||
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o main cmd/main.go
|
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o main cmd/main.go
|
||||||
|
|
||||||
push:
|
push:
|
||||||
|
if: 0
|
||||||
name: Push Docker Images
|
name: Push Docker Images
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
needs: lint
|
needs: lint
|
||||||
if: ${{ gitea.ref == 'refs/heads/master' || gitea.ref == 'refs/heads/release' }}
|
# if: ${{ gitea.ref == 'refs/heads/master' || gitea.ref == 'refs/heads/release' }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -140,6 +139,9 @@ jobs:
|
|||||||
tag:
|
tag:
|
||||||
name: Tag Commit
|
name: Tag Commit
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
rules:
|
||||||
|
- if: github.event_name == 'push' && github.ref_type == 'tag'
|
||||||
|
when: never
|
||||||
# needs: lint
|
# needs: lint
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -151,8 +153,10 @@ jobs:
|
|||||||
- name: Get latest tag
|
- name: Get latest tag
|
||||||
id: get-latest-tag
|
id: get-latest-tag
|
||||||
run: |
|
run: |
|
||||||
git fetch --tags
|
git fetch --tags --force
|
||||||
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo 'v0.0.0')
|
|
||||||
|
LATEST_TAG=$(git tag -l "v*" | sort -V | tail -n 1)
|
||||||
|
echo $LATEST_TAG
|
||||||
|
|
||||||
if [[ $LATEST_TAG =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
if [[ $LATEST_TAG =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
||||||
MAJOR=${BASH_REMATCH[1]}
|
MAJOR=${BASH_REMATCH[1]}
|
||||||
@@ -164,12 +168,28 @@ jobs:
|
|||||||
PATCH=0
|
PATCH=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo $MAJOR.$MINOR.$PATCH
|
||||||
|
|
||||||
NEW_PATCH=$((PATCH + 1))
|
NEW_PATCH=$((PATCH + 1))
|
||||||
NEW_TAG="v${MAJOR}.${MINOR}.${NEW_PATCH}"
|
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: |
|
run: |
|
||||||
git tag ${{ steps.get-latest-tag.outputs.NEW_TAG }}
|
git tag ${{ steps.get-latest-tag.outputs.NEW_TAG }}
|
||||||
git push origin ${{ 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