76 ШЕСТЬ
All checks were successful
Go Linter / Run golangci-lint (api_gateway) (push) Successful in 3m57s
Go Linter / Push Docker Images (api_gateway) (push) Successful in 29s
Go Linter / Build golang services (api_gateway) (push) Successful in 2m21s
Deploy Production / Deploy to Staging (push) Has been skipped
Go Linter / Tag Commit (push) Successful in 9s
All checks were successful
Go Linter / Run golangci-lint (api_gateway) (push) Successful in 3m57s
Go Linter / Push Docker Images (api_gateway) (push) Successful in 29s
Go Linter / Build golang services (api_gateway) (push) Successful in 2m21s
Deploy Production / Deploy to Staging (push) Has been skipped
Go Linter / Tag Commit (push) Successful in 9s
This commit is contained in:
@@ -14,7 +14,6 @@ jobs:
|
||||
lint:
|
||||
name: Run golangci-lint
|
||||
runs-on: ubuntu-22.04
|
||||
if: 0
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
@@ -71,10 +70,65 @@ jobs:
|
||||
SWAGGER_HOST=${HOST} make docs
|
||||
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o main cmd/main.go
|
||||
|
||||
tag:
|
||||
name: Tag Commit
|
||||
runs-on: ubuntu-22.04
|
||||
rules:
|
||||
- if: github.event_name == 'push' && github.ref_type == 'tag'
|
||||
when: never
|
||||
needs: lint
|
||||
|
||||
steps:
|
||||
- name: Checkout репозитория
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get latest tag
|
||||
id: get-latest-tag
|
||||
run: |
|
||||
git fetch --tags --force
|
||||
|
||||
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
|
||||
MAJOR=${BASH_REMATCH[1]}
|
||||
MINOR=${BASH_REMATCH[2]}
|
||||
PATCH=${BASH_REMATCH[3]}
|
||||
else
|
||||
MAJOR=0
|
||||
MINOR=0
|
||||
PATCH=0
|
||||
fi
|
||||
|
||||
echo $MAJOR.$MINOR.$PATCH
|
||||
|
||||
NEW_PATCH=$((PATCH + 1))
|
||||
NEW_TAG="v${MAJOR}.${MINOR}.${NEW_PATCH}"
|
||||
|
||||
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
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: 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 }}"
|
||||
|
||||
push:
|
||||
name: Push Docker Images
|
||||
runs-on: ubuntu-22.04
|
||||
# needs: lint
|
||||
needs:
|
||||
lint
|
||||
tag
|
||||
if: ${{ gitea.ref == 'refs/heads/master' || gitea.ref == 'refs/heads/release' }}
|
||||
|
||||
strategy:
|
||||
@@ -98,8 +152,6 @@ jobs:
|
||||
GIT_SHA=$(git rev-parse --short HEAD)
|
||||
GIT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none")
|
||||
|
||||
echo "GIT_TAG = ${GIT_TAG}"
|
||||
|
||||
TARGET_ENV=${{ github.ref == 'refs/heads/release' && 'staging' || 'production' }}
|
||||
|
||||
echo "GIT_SHA=${GIT_SHA}" >> $GITHUB_OUTPUT
|
||||
@@ -154,56 +206,3 @@ jobs:
|
||||
docker push $IMAGE_NAME:latest
|
||||
|
||||
echo "Pushed image $IMAGE_NAME:$IMAGE_TAG and :latest"
|
||||
|
||||
tag:
|
||||
name: Tag Commit
|
||||
runs-on: ubuntu-22.04
|
||||
rules:
|
||||
- if: github.event_name == 'push' && github.ref_type == 'tag'
|
||||
when: never
|
||||
needs: lint
|
||||
|
||||
steps:
|
||||
- name: Checkout репозитория
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get latest tag
|
||||
id: get-latest-tag
|
||||
run: |
|
||||
git fetch --tags --force
|
||||
|
||||
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
|
||||
MAJOR=${BASH_REMATCH[1]}
|
||||
MINOR=${BASH_REMATCH[2]}
|
||||
PATCH=${BASH_REMATCH[3]}
|
||||
else
|
||||
MAJOR=0
|
||||
MINOR=0
|
||||
PATCH=0
|
||||
fi
|
||||
|
||||
echo $MAJOR.$MINOR.$PATCH
|
||||
|
||||
NEW_PATCH=$((PATCH + 1))
|
||||
NEW_TAG="v${MAJOR}.${MINOR}.${NEW_PATCH}"
|
||||
|
||||
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
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: 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 }}"
|
||||
|
||||
Reference in New Issue
Block a user